mother_child(sue,jerry).
mother_child(sue,jerry).
mother_child(kerry,dan).
mother_child(kate,ann).
mother_child(ann,joe).
mother_child(ann,bo).
father_child(hue,jerry).
father_child(jerry,dan).
father_child(nate, ann).
father_child(dan,joe).
father_child(dan,bo).

parent_child(X,Y) :- father_child(X,Y) ; mother_child(X,Y).

sibling(X,Y) :- X \== Y, parent_child(Z,X), parent_child(Z,Y).
sib(X,Y) :- parent_child(Z,X), parent_child(Z,Y), X \== Y.

related(X,Y) :- parent_child(X,Y).
related(X,Y) :- related(Y,X).

ggrade(N,a) :- !, N>=90.
ggrade(N,b) :- N>=80, ! .
ggrade(N,c) :- N>=70, ! .
ggrade(N,d) :- N>=60, ! .
ggrade(N,f) :- N<51, ! .
ggrade(N,pass) :- N>=60, ! .
ggrade(N,fail).

        remove(A,[A|B],B).
                remove(A,[R|B],[R|C]) :- remove(A,B,C).

permutation([],[]).
permutation([X|Xs],Ys) :- permutation(Ys,Zs),remove(X,Xs,Zs).
