father('tom','amy')<-
father('jack','fred')<-
father('tony','carolII')<-
father('fred','carolIII')<-
mother('graceI','amy')<-
mother('amy','fred')<-
mother('carolI','carolII')<-
mother('carolII','carolIII')<-

parent(X,Y) <- father(X,Y)
parent(X,Y) <- mother(X,Y)

ancestor(X,Y) <- parent(X,Y)
ancestor(X,Y) <- parent(X,Z) and ancestor(Z,Y)

answer(a,b)<-ancestor(a,b)