Depth First Search#8760

Depth First Search

1 second
128 megabytes
Easy

The undirected graph is given. Start a depth-first search from the given vertex and print the vertex numbers in the order of their first visit.

Input

The first line contains the number of vertices n~(n \le 100) and edges of the graph. Each of the following lines contains two vertices and — an undirected edge of the graph. The last line contains the vertex .

Output

Start a depth-first search from vertex and print the vertex numbers in the order of their first visit.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading