#include<bits/stdc++.h>
using namespace std;
int n,e,x,y,a[50][50];
void dfs(int x){
printf("%d",x);
for(int j=1;j<=n;j++){
if(a[x][j]==1){
a[x][j]=0;
a[j][x]=0;
dfs(j);
}
}
}
int main(){
scanf("%d%d",&n,&e);
while(e--){
scanf("%d%d",&x,&y);
for(int i=1;i<=n;i++){
a[x][y]=1;
a[y][x]=1;
a[x][0]++;
a[y][0]++;
}
int c=0;
for(int i=1;i<=n;i++) if(a[i][0]%2==1) c++;
if(c==0) dfs(1),printf("1");
else dfs(n);
}
return 0;
}
/**************************************************************
Problem: 2055
User: liyunshuo
Language: C++
Result: Wrong Answer
****************************************************************/