An undirected graph is given. Run a depth-first search from the given vertex . Print the timestamps d_v and up_v for each vertex in the increasing order of vertices.
The first line contains the number of vertices (n \le 100) and edges of an undirected graph. Vertices are numbered from to . Each of the next lines contains two vertices and - an undirected edge of the graph. The last line contains vertex , from which the search begins.
Run . Print the timestamps d_v and up_v for each vertex (v = 1, 2, \ldots, n). The timestamps for each vertex must be printed on a separate line.
Exemple 1
Exemple 2
Use the adjacency matrix for storing the graph.
