temp_decomp_0_0(GPX,GPY) :- parent(GPX,GGP), parent(GPY,GGP). temp_decomp_0_1(GPX,PY) :- parent(PY,GPY), temp_decomp_0_0(GPX,GPY). temp_decomp_0_2(GPX,Y) :- parent(Y,PY), temp_decomp_0_1(GPX,PY). temp_decomp_0_3(PX,Y) :- parent(PX,GPX), temp_decomp_0_2(GPX,Y). uptosecondcousin(X,Y) :- parent(X,PX), X!=Y, temp_decomp_0_3(PX,Y).