You are given the start and finish times of a DFS (Depth-first search) traversal of the vertices that are available in a rooted tree. Your task is to restore the tree.
Input format
Note:
Output format
Print n integers. The ith integer denotes the parent of the ith vertex or 0 if it is the root of the tree.
Note: The vertices of the tree are numbered from 1 to n.
Constraints
n≤300000
Note that the interval of a vertex is open-ended ( [startingv,finishingv) ).