concat(leaf,Y,Y).
concat(cons(U,V),Y,cons(U,Z)):- concat(V,Y,Z).
less_leaves(X,leaf,false).
less_leaves(leaf,cons(W,Z),true).
less_leaves(cons(U,V),cons(W,Z),T):- concat(U,V,X), concat(W,Z,Y), less_leaves(X,Y,T).
