#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
struct node {
int ch[2], fa, val, size;
int tag;
} tree[N];
int n, m, tot, root;
int get(int x) {
return x = tree[tree[x].fa].ch[1];
}
void pushup(int x) {
if (x == 0)
return ;
tree[x].size = tree[tree[x].ch[0]].size + tree[tree[x].ch[1]].size + 1;
}
void pushdown(int x) {
if (tree[x].tag) {
tree[tree[x].ch[0]].tag ^= 1;
tree[tree[x].ch[1]].tag ^= 1;
swap(tree[tree[x].ch[0]].ch[0], tree[tree[x].ch[0]].ch[1]);
swap(tree[tree[x].ch[1]].ch[0], tree[tree[x].ch[1]].ch[1]);
tree[x].tag = 0;
}
}
void rotate(int x) {
int y = tree[x].fa, z = tree[y].fa;
int chk = get(x);
tree[y].ch[chk] = tree[x].ch[chk ^ 1];
if (tree[x].ch[chk ^ 1])
tree[tree[x].ch[chk ^ 1]];
tree[x].ch[chk ^ 1] = y;
tree[y].fa = x;
if (z)
tree[z].ch[y == tree[z].ch[1]] = x;
tree[x].fa = z;
pushup(y);
pushup(x);
}
void splay(int x, int k) {
while (tree[x].fa != k) {
int y = tree[x].fa, z = tree[y].fa;
if (z != k) {
if (get(x) == get(y)) {
rotate(y);
} else
rotate(x);
}
}
if (!k)
root = x;
}
void insert(int x) {
int fa = 0, cur = root;
while (cur) {
fa = cur;
cur = tree[cur].ch[x > tree[cur].val];
}
cur = ++tot;
tree[cur].val = x;
tree[cur].fa = fa;
tree[fa].ch[x > tree[fa].val] = cur;
pushup(cur);
pushup(fa);
splay(cur, 0);
}
int find(int x) {
int cur = root;
while (cur) {
pushdown(cur);
if (x <= tree[tree[cur].ch[0]].size)
cur = tree[cur].ch[0];
else {
if (x <= tree[tree[cur].ch[0]].size + 1)
return cur;
else {
x -= tree[tree[cur].ch[0]].size + 1;
cur = tree[cur].ch[1];
}
}
}
}
void print(int x) {
pushdown(x);
if (tree[x].ch[0])
print(tree[x].ch[0]);
if (tree[x].val >= 1 && tree[x].val <= n) {
cout << tree[x].val << " ";
}
if (tree[x].ch[1])
print(tree[x].ch[1]);
}
int main() {
cin >> n >> m;
for (int i = 0; i <= n + 1; i++) {
insert(i);
}
while (m--) {
int x, y;
cin >> x >> y;
int l = find(x), r = find(y + 2);
splay(1, 0);
splay(r, l);
tree[tree[r].ch[0]].tag ^= 1;
swap(tree[tree[r].ch[0]].ch[0], tree[tree[r].ch[0]].ch[1]);
}
print(root);
return 0;
}