Print nodes at K Distance - Binary Trees

https://hack.codingblocks.com/contests/c/537/1604

https://ide.codingblocks.com/s/70052

The problem with my code is that I am not able to understand how to look for the sibling nodes. I am able to find and print ancestor and descendant nodes which are at ‘k’ distance but not to able to work for the sibling nodes.
I am not even able to pass the given sample case in the problem as the second testcase requires printing the sibling node

Please suggest some approach or modification to the code .

This problem is based on Graph, So you can easily solve this problem by applying bfs shortest path algorithm on a given node specified in input. Try to learn graph/BFS

you can refer to this code
https://ide.codingblocks.com/s/70088
idea is to create 2 functions
1)to print nodes k down from a given node
2)get a list of nodes from root to target
rest you can refer from code