ma_order(Pred, Doll1, Doll2) :- ma_type(Doll1, Type1), ma_type(Doll2, Type2), compare(Pred1, Type1, Type2), ( Pred1\==(=) -> Pred=Pred1 ; ma_size(Doll1, Size1), ma_size(Doll2, Size2), compare(Pred, Size1, Size2) ).