finding friend according to the distance