文件目录

#include <iostream>
using namespace std;
int f[105][105];
int n, m, a, b;
int d[105]; // 计算度数
void dfs(int x)
{
    for (int i = 1; i <= n; i++)
    {
        if (f[i][x])
        {
            f[i][x] = f[x][i] = 0;
            dfs(i);
        }
    }
    cout << x << " ";
}
int main()
{
    cin >> n >> m;
    while (m--)
    {
        cin >> a >> b;
        f[a][b] = f[b][a] = 1;
        d[a]++;
        d[b]++;
    }
    for (int i = 1; i <= n; i++)
    {
        if (d[i] % 2 == 1 || i == n)
        {
            dfs(i);
            break;
        }
    }
    return 0;
}