query(p18,p,[p,q,r],[p,q,r],[]). %----------------------------------------------------------- :- table p / 0. :- table q / 0. :- table r / 0. p :- q, r. p :- r. q. r.