C.J. a billy goat is a male, and a nanny goat is a female.
Let's see if I can remember the lyrics to this child's song:
On a bluff, on a bluff, there lived three billy goats gruff.
Great big billy goat; medium sized billy goat; great big billy goat gruff.
The billy goats wanted to cross the bridge to get to the fresh grass on the other side, but under the bridge there lived a troll.
Troll: I'm a troll folderoll, I'm a troll folderoll, I'm a troll folderoll and I'll eat you for my supper. I've three eyes and I've three ears, I've three eyes and I've three ears, I've three eyes and I've three ears and when I cry I cry real tears.
So the little billy goat goes first and tells the troll that he is too little to be tasty, but to wait for his brother who is fatter. So the little billy goat gets to the other side.
Then comes medium sized billy goat and tell the troll the same story about his bigger brother, etc.
Of course, when the troll attempts to eat big billy goat gruff, be butts the troll somewhere over the rainbow.
Variations of the story have the troll simply being lonely and wanting a friend.
So, the happy ending is that all become friends and trek off together holding horns and singing.