print nodes at k distance