p(M,I):-member(C,M),p([!],[[-!|C]|M],[],I).
p(C,M,P,I):-
C=[];C=[L|G],(-N=L;-L=N)->(member(N,P);\+length(P,I),
member(D,M),copy_term(D,E),append(A,[N|B],E),
append(A,B,F),p(F,M,[L|P],I)),p(G,M,P,I).
