mother(marge, lisa). mother(marge, bart).
father(homer, bart). father(grampa, homer).

parent(X, Y) :- father(X, Y).
parent(X, Y) :- mother(X, Y).

grandparent(X, Y) :- parent(X, Z), parent(Z, Y).
