grandparentOf(X, Y)      :- parentOf(X, Z), parentOf(Z, Y) 
greatGrandparentOf(X, Y) :- parentOf(X, Z), grandparentOf(Z, Y)  
auntUncleOf(X, Y):- siblingOf(X, Z), parentOf(Z, Y)
greatAuntUncleOf(X, Y)   :- siblingOf(X, Z), grandparentOf(Z, Y) 
secondAuntUncleOf(X, Y)  :- parentOf(Z, X), greatAuntUncleOf(Z, Y) 
childOf(X, Y)   :- parentOf(Y, X) 
grandchildOf(X, Y)      :- grandparentOf(Y, X)    
greatGrandchildOf(X, Y) :- greatGrandparentOf(Y, X) 
nieceNephewOf(X, Y)     :- auntUncleOf(Y, X)
siblingOf(X, Y):- siblingOf(Y, X) 
siblingOf(X, Y):- parentOf(Z, X), parentOf(Z, Y), X<>Y  
cousinOf(X, Y) :- cousinOf(Y, X)
cousinOf(X, Y) :- parentOf(Z, X), auntUncleOf(Z, Y)     
secondCousinOf(X, Y)   :- secondCousinOf(Y, X)  
secondCousinOf(X, Y)   :- parentOf(Z, X), secondAuntUncleOf(Z, Y) 
firstCousinOnceRemovedOf(X, Y) :- cousinOf(Y, Z), parentOf(Z, X) 
sisterOf(X, Y)     :- siblingOf(X, Y), female(X)
brotherOf(X, Y)    :- siblingOf(X, Y), male(X)
motherOf(X, Y)     :- parentOf(X, Y), female(X) 
fatherOf(X, Y)     :- parentOf(X, Y), male(X) 
grandmotherOf(X, Y):- grandparentOf(X, Y), female(X)  
grandfatherOf(X, Y):- grandparentOf(X, Y), male(X)    
greatGrandmotherOf(X, Y)   :- greatGrandparentOf(X, Y), female(X)     
greatGrandfatherOf(X, Y)   :- greatGrandparentOf(X, Y), male(X) 
auntOf(X, Y)       :- auntUncleOf(X, Y), female(X)    
uncleOf(X, Y)      :- auntUncleOf(X, Y), male(X)
greatAuntOf(X, Y)  :- greatAuntUncleOf(X, Y), female(X) 
greatUncleOf(X, Y) :- greatAuntUncleOf(X, Y), male(X) 
secondAuntOf(X, Y) :- secondAuntUncleOf(X, Y), female(X)
secondUncleOf(X, Y):- secondAuntUncleOf(X, Y), male(X)
girlCousinOf(X, Y) :- cousinOf(X, Y), female(X) 
boyCousinOf(X, Y)  :- cousinOf(X, Y), male(X) 
girlSecondCousinOf(X, Y)   :- secondCousinOf(X, Y), female(X) 
boySecondCousinOf(X, Y)    :- secondCousinOf(X, Y), male(X)   
girlFirstCousinOnceRemovedOf(X, Y) :- firstCousinOnceRemovedOf(X, Y), female(X) 
boyFirstCousinOnceRemovedOf(X, Y)  :- firstCousinOnceRemovedOf(X, Y), male(X) 
daughterOf(X, Y)   :- childOf(X, Y), female(X)
sonOf(X, Y):- childOf(X, Y), male(X)  
granddaughterOf(X, Y)      :- grandchildOf(X, Y), female(X)   
grandsonOf(X, Y)   :- grandchildOf(X, Y), male(X)     
greatGranddaughterOf(X, Y) :- greatGrandchildOf(X, Y), female(X)
greatGrandsonOf(X, Y)      :- greatGrandchildOf(X, Y), male(X)
nieceOf(X, Y)      :- nieceNephewOf(X, Y), female(X)  
nephewOf(X, Y)     :- nieceNephewOf(X, Y), male(X)    
