first steps of of Pairwise Algorithm