#include <bits/stdc++.h>
using namespace std;
ifstream fin("ciclueuler.in");
ofstream fout("ciclueuler.out");
const int NMAX = 1e5;
const int MMAX = 5e5;
int n, m, x, y;
vector < pair<int,int> > graf[NMAX+1];
vector <int> st;
int grad[NMAX+1];
bool trecut[MMAX+1];
int ans[NMAX+1];
int main()
{
fin >> n >> m;
for(int i=1; i<=m; i++)
{
fin >> x >> y;
graf[x].push_back(make_pair(y,i));
graf[y].push_back(make_pair(x,i));
grad[x]++; grad[y]++;
}
for(int i=1; i<=n; i++)
if(grad[i] % 2)
{
fout << -1;
return 0;
}
st.push_back(1);
int cnt = 0;
while(!st.empty())
{
bool gol = false;
int nod = st.back();
if(!graf[nod].empty())
{
pair<int,int> a = graf[nod].back();
if(!trecut[a.second])
{
st.push_back(a.first);
trecut[a.second] = true;
}
graf[nod].pop_back();
}
else
gol = true;
if(!st.empty() && gol == true)
ans[++cnt] = st.back(), st.pop_back();
}
if(cnt-1 != m)
{
fout << -1;
return 0;
}
for(int i=1; i<cnt; i++)
fout << ans[i] << ' ';
return 0;
}