parent(eva, bob).
parent(eva, pat).
parent(bob, ann).
parent(bob, pam).
parent(pat, joe).
parent(ann, jim).
parent(pam, sam).
parent(joe, gus).
parent(joe, leo).
parent(jim, kim).
parent(jim, ben).
parent(leo, liz).

siblings(X, Y) :-
   X \= Y,
   parent(Z, X),
   parent(Z, Y).

cousins(X, Y) :-
   parent(P, X),
   parent(Q, Y),
   siblings(P, Q).

same_gen(X, Y) :-
   siblings(X, Y).
same_gen(X, Y) :-
   parent(P, X),
   parent(Q, Y),
   same_gen(P, Q).
