On adaptivity and minimax optimality of two-sided nearest neighbors