Hi, i'm a newbie in prolog. It would be very helpful if sombody cud solve this question for me.

Assume the existence of the parent(X,Y) fact that asserts that X is a parent of
Y. Write the rule chain(X,Y,L): if X is an ancestor of Y, then L is a list of all ancestors of
Y who are descendants of X. For example, if chain(peter,mary,[paul,sue]), then peter
is the parent of paul, paul is the parent of sue, and sue is the parent of mary.