An undirected disconnected graph is given. Perform a depth-first search on it. For each vertex output the timestamps when it becomes gray / black in the order of their first visit.
The first line contains the number of vertices (n \le 100) of the undirected graph. Each of the following lines contains two vertices and - an undirected edge of the graph.
Perform a depth-first search on the graph. For each vertex in a separate line, output the timestamps when it becomes gray / black in the order of their first visit. Vertices should be traversed in order of increasing numbers.

Example 1