nelcesto(a).
nelcesto(b).
nelcesto(c).
nelcesto(d).

sov(X,a):- nelcesto(X), not(X==a).
sov(b,c).
sov(d,b).

pala(0,[]).
pala(1,[X]):- nelcesto(X).
pala(H,[X,Y|R]) :- H > 0, sov(X,Y), H1 is H-1, 
                   pala(H1,[Y|R]),
                   not(member(X,[Y|R])).



