There is a tree that consists of one node(the root) let it be (1).
There is some queries each query is either
find if x is ancestor of y.
make x a son of y(its guaranteed that y exist).
If the first query does not exist its easy to solve it using DFS but I am stuck at finding a solution for the whole problem.
How to solve this?