Problem2126--dfs

2126: dfs

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

        一个有n个节点的连通图,这些节点以编号:1、2、……n进行编号,现给出节点间的连接关系。请以节点1为起点,按dfs的顺序遍历并输出该图。

Input

第一行为两整数,n和e,表示n个顶点,e条边
以下e行每行两个数,表示两个节点是联通的

Output

只有一行,为节点的dfs顺序

Sample Input Copy

5 7
1 2
1 3
1 4
2 4
2 5
3 5
4 5

Sample Output Copy

1 2 4 5 3

HINT

上传者:吕红波