pairwise term final version both pairwise and higher order term inseide