#include <cstdio>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
FILE *f = fopen("ciclueuler.in","r");
FILE *g = fopen("ciclueuler.out","w");
int N,M;
vector<pair<int,int> > G[100005];
bool U[500005];
int st[500005];
int len;
int gr[100005];
int nr;
int main()
{
fscanf(f,"%d %d",&N,&M);
for(int i = 1;i <= M;i++){
int x,y;
fscanf(f,"%d %d",&x,&y);
G[x].push_back({y,i});
G[y].push_back({x,i});
nr = nr + (gr[x] % 2 == 0 ? 1:-1) + (gr[y] % 2 == 0 ? 1:-1);
gr[x]++;
gr[y]++;
}
if(nr){
fprintf(g,"-1");
return 0;
}
st[++len] = 1;
while(len){
int nod = st[len];
while(!G[nod].empty() && U[G[nod].back().second]){
G[nod].pop_back();
}
if(!G[nod].empty()){
int v = G[nod].back().first;
U[G[nod].back().second] = 1;
G[nod].pop_back();
st[++len] = v;
}
else{
if(len != 1){
fprintf(g,"%d ",nod);
}
len--;
}
}
fclose(f);
fclose(g);
return 0;
}