Query parent who just has only one child

I have some document and every doc have some other related documents.

Now, I want to know which parent doc has only one child doc.

What should I do ?

Or is there any better way ?