#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <bitset>
#include <assert.h>
#include <unordered_map>
using namespace std;
typedef long long ll;
#define Cmp(a, b) memcmp(a, b, sizeof(b))
#define Cpy(a, b) memcpy(a, b, sizeof(b))
#define Set(a, v) memset(a, v, sizeof(a))
#define debug(x) cout << #x << ": " << x << endl
#define _forS(i, l, r) for(set<int>::iterator i = (l); i != (r); i++)
#define _rep(i, l, r) for(int i = (l); i <= (r); i++)
#define _for(i, l, r) for(int i = (l); i < (r); i++)
#define _forDown(i, l, r) for(int i = (l); i >= r; i--)
#define debug_(ch, i) printf(#ch"[%d]: %d\n", i, ch[i])
#define debug_m(mp, p) printf(#mp"[%d]: %d\n", p->first, p->second)
#define debugS(str) cout << "dbg: " << str << endl;
#define debugArr(arr, x, y) _for(i, 0, x) { _for(j, 0, y) printf("%c", arr[i][j]); printf("\n"); }
#define _forPlus(i, l, d, r) for(int i = (l); i + d < (r); i++)
#define lowbit(i) (i & (-i))
#define MPR(a, b) make_pair(a, b)
pair<int, int> crack(int n) {
int st = sqrt(n);
int fac = n / st;
while (n % st) {
st += 1;
fac = n / st;
}
return make_pair(st, fac);
}
inline ll qpow(ll a, int n) {
ll ans = 1;
for(; n; n >>= 1) {
if(n & 1) ans *= 1ll * a;
a *= a;
}
return ans;
}
template <class T>
inline bool chmax(T& a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
ll gcd(ll a, ll b) {
return b == 0 ? a : gcd(b, a % b);
}
ll ksc(ll a, ll b, ll mod) {
ll ans = 0;
for(; b; b >>= 1) {
if (b & 1) ans = (ans + a) % mod;
a = (a * 2) % mod;
}
return ans;
}
ll ksm(ll a, ll b, ll mod) {
ll ans = 1 % mod;
a %= mod;
for(; b; b >>= 1) {
if (b & 1) ans = ksc(ans, a, mod);
a = ksc(a, a, mod);
}
return ans;
}
template <class T>
inline bool chmin(T& a, T b) {
if(a > b) {
a = b;
return true;
}
return false;
}
template<class T>
bool lexSmaller(vector<T> a, vector<T> b) {
int n = a.size(), m = b.size();
int i;
for(i = 0; i < n && i < m; i++) {
if (a[i] < b[i]) return true;
else if (b[i] < a[i]) return false;
}
return (i == n && i < m);
}
// ============================================================== //
const int maxn = 1e5 + 10;
int n, m;
class Splay {
public:
struct node {
int son[2], pa;
int sz, tag, v;
void init(int _v, int _pa) {
v = _v, pa = _pa;
sz = 1;
}
};
int tot;
int root = 0, idx = 0;
vector<node> t;
Splay() = default;
Splay(int _n) : tot(_n) {
t.resize(tot);
root = 0, idx = 0;
}
inline void mark(int p) {
t[p].tag = 1;
}
void push(int p) {
if (!t[p].tag) return;
swap(t[p].son[0], t[p].son[1]);
t[t[p].son[0]].tag ^= 1, t[t[p].son[1]].tag ^= 1;
t[p].tag = 0;
return;
}
void pull(int p) {
t[p].sz = t[t[p].son[0]].sz + t[t[p].son[1]].sz + 1;
}
void insert(int v) {
int u = root, p = 0;
while (u) p = u, u = t[u].son[v > t[u].v];
u = ++idx;
if (p > 0) t[p].son[v > t[p].v] = u;
t[u].init(v, p);
splay(u, 0);
}
void rotate(int x) {
int y = t[x].pa, z = t[y].pa;
int k = t[y].son[1] == x;
// connect
t[z].son[t[z].son[1] == y] = x, t[x].pa = z;
t[y].son[k] = t[x].son[k^1], t[t[x].son[k^1]].pa = y;
t[x].son[k^1] = y, t[y].pa = x;
pull(y), pull(x);
}
void splay(int x, int k) {
while (t[x].pa != k) {
int y = t[x].pa, z = t[y].pa;
if (z != k) {
if ((t[z].son[1] == y) ^ (t[y].son[1] == x)) rotate(x);
else rotate(y);
}
rotate(x);
}
if (k == 0) root = x;
}
int get_k(int v) {
int u = root;
while (true) {
push(u);
if (t[t[u].son[0]].sz >= v) u = t[u].son[0];
else if (t[t[u].son[0]].sz + 1 == v) return u;
else v -= t[t[u].son[0]].sz + 1, u = t[u].son[1];
}
return -1;
}
void out(int p) {
push(p);
if (t[p].son[0]) out(t[p].son[0]);
if (t[p].v >= 1 && t[p].v <= n) printf("%d ", t[p].v);
if (t[p].son[1]) out(t[p].son[1]);
}
} spl(maxn);
int main() {
freopen("input.txt", "r", stdin);
scanf("%d%d", &n, &m);
// build splay
for (int i = 0; i <= n+1; i++) spl.insert(i);
while (m--) {
int li, ri;
scanf("%d%d", &li, &ri);
int l = spl.get_k(li), r = spl.get_k(ri+2);
spl.splay(l, 0), spl.splay(r, l);
spl.mark(spl.t[r].son[0]);
}
spl.out(spl.root);
}