selecting node recursively