#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <assert.h>
#include <stack>

using namespace std;

vector< pair<int, int> > ch;

bool check()
{
	stack<int> st;
	for (int i = 0; i < ch.size(); i++)
	{
		if (i != 0 && ch[i - 1].first == ch[i].first) return false;
		if (ch[i].second < 0 && st.empty())
			return false;
		if (ch[i].second < 0 && st.top() != abs(ch[i].second))
			return false;
		if (ch[i].second < 0)
			st.pop();
		else
			st.push(ch[i].second);
	}
	return true;
};

int main()
{
    freopen("army.in", "r", stdin);
    freopen("army.out", "w", stdout);
    int n;
    cin >> n;
	assert(2 <= n && n <= 100000);
    vector<int> ans(n + 1);
    for (int i = 1; i <= n; i++)
        ans[i] = i;
	int m;
	cin >> m;
	assert(1 <= m && m <= 100000);
	for (int i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
       	assert(1 <= a && a <= n);
		assert(1 <= b && b <= n);
		ch.push_back(make_pair(min(a, b), i + 1));
		ch.push_back(make_pair(max(a, b), - i - 1));

        int l = 0, r = 0;
        for (int j = 1; j <= n; j++)
        {
            if (ans[j] == a) l = j;
            if (ans[j] == b) r = j;
        }
        for (int j = min(l, r); j <= (r + l) / 2; j++)
            swap(ans[j], ans[r + l - j]);
	}
    sort(ch.begin(), ch.end());
	assert(check());

    for (int i = 1; i <= n; i++)
		cout << ans[i] << (i == n ? "\n" : " "); 
}