/* ###########################
# Author : Pranay Garg #
# College : SGSITS #
###########################
*/
# include <bits/stdc++.h>
# include <ext/pb_ds/assoc_container.hpp>
# define ll long long int
# define ull unsigned long long int
# define double long double
# define sp(x,y) fixed << setprecision(y) << x
# define ironman ios_base::sync_with_stdio(false);cin.tie(NULL);
# define MOD 1000000007
# define MODT 998244353
# define endl '\n'
# define clr(x,a) memset(x,a,sizeof(x))
# define ar array
# define INF 1000000000000000000ll + 239
# define PI 3.14159265358979323846
# define fi first
# define se second
# define vi std::vector<ll>
# define pb push_back
# define pi pair<ll,ll>
# define all(a) a.begin(), a.end()
# define allr(a) a.rbegin(), a.rend()
# define alla(a,n) a,a+n
# define debug1(x) cout<<#x<<" = "<<x<<endl;
# define debug2(x,y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<endl;
# define debug3(x,y,z) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<endl;
# define debug4(x,y,z,w) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#w <<" = "<<w<<endl;
# define debug5(x,y,z,w,v) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#w <<" = "<<w<<" "<<#v <<" = "<<v<<endl;
# define debug6(x,y,z,w,a,b) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<" "<<#z<<" = "<<z<<" "<<#w <<" = "<<w<<" "<<#a<<" = "<<a<<" "<<#b<<" = "<<b<<endl;
# define max(...)({ \
ll nos[] = { __VA_ARGS__ }; \
ll n = sizeof(nos)/sizeof(ll); \
*std::max_element(&nos[0],&nos[n]); \
})
# define min(...)({ \
ll nos[] = { __VA_ARGS__ }; \
ll n = sizeof(nos)/sizeof(ll); \
*std::min_element(&nos[0],&nos[n]); \
})
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
template<typename... T>
void read(T&... args)
{
((cin >> args), ...);
}
template<typename... T>
void write(T... args)
{
((cout << args << " "), ...);
}
void fastio()
{
ironman
#ifndef ONLINE_JUDGE
freopen("test_input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
freopen("error.txt", "w", stderr);
#endif
}
template<class T>
void printVector(const std::vector<T> arr)
{
for (auto i : arr)
cout << i << " ";
cout << endl;
}
template<class T>
void printArray(T arr[], ll n)
{
for (ll i = 0; i < n; i++)
cout << arr[i] << " ";
cout << endl;
}
template<class T>
void printUGraph(vector<T> arr[], ll n)
{
for(ll i=0;i<n;i++)
{
cout << i << " : ";
for(auto j : arr[i])
cout << j << " ";
cout << endl;
}
}
template<class T>
void printWGraph(vector<T> arr[], ll n)
{
for(ll i=0;i<n;i++)
{
cout << i << " : ";
for(auto j : arr[i])
cout << j.fi << "," << j.se << " ";
cout << endl;
}
}
//const int p1 = 13331,m1 = 1e9+9,p2 = 7919, m2 = 1e9+9;
//const int p1 = 97266353,m1 = 972663749,p2 = 97336357, m2 = 1000000007;
//const int p1 = 31 ,m1 = 1e9+7;
//grid cells
//D U R L
//ll dx[] = {1, -1, 0, 0};
//ll dy[] = {0, 0, 1, -1};
// bool isSafe(ll x, ll y, ll n, ll m)
// {
// return (x >= 0 && x < n && y >= 0 && y < m);
// }
//---------------TEMPLATE ABOVE--------------//
const int maxn = 2e5+5;
vector<ar<ll,2>> graph[maxn];
//deque<ll> ans;
vi ans;
ll n,m,c=0;
vi deg,vis;
void dfs(ll node)
{
// debug1(node);
for(auto i : graph[node])
{
if(!vis[i[1]])
{
c++;
vis[i[1]] = 1;
dfs(i[0]);
}
}
// ans.push_front(node);
ans.pb(node);
}
void solve()
{
read(n,m);
deg.assign(n,0);
for(ll i=0;i<m;i++)
{
ll u,v;
read(u,v);
u--;v--;
deg[u]++;
deg[v]++;
graph[u].pb({v,i});
graph[v].pb({u,i});
}
ll odd = 0,s=0;
for(ll i=0;i<n;i++)
{
odd+=((deg[i]%2)==1);
}
if(odd!=0)
{
cout << "IMPOSSIBLE" << endl;
return;
}
vis.assign(m,0);
dfs(0);
if(c!=m)
{
cout << "IMPOSSIBLE" << endl;
return;
}
reverse(all(ans));
for(auto i : ans)
cout << i+1 << " ";
cout << endl;
}
int main()
{
ironman
fastio();
ll t = 1;
ll cases = t;
while (t--)
{
// cout << "Case #" << cases-t << ": ";
solve();
}
}