Depth First Search - Timestamps
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Undirected graph is given. Run depth first search from the given vertex . Print the timestamps and for each vertex in the increasing order of vertices.
Input
The first line contains number of vertices and edges of undirected graph. Each of the next lines contains two vertices and — an undirected edge of the graph. The last line contains vertex .
Output
Run . Print the timestamps and for each vertex . The timestamps for each vertex must be printed in a separate line.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 2K
Acceptance rate 64%