#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <iostream>
#include <cstdio>
#include <queue>
#define rep(i, l, r) for(int i = l; i <= r; i++)
#define down(i, l, r) for(int i = l; i >= r; i--)
#define MS 123456
#define MAX 1037471823
#define Q 1
using namespace std;
int n, m, s[MS], l[MS], r[MS], h[MS], now, k[MS], c, b, e;
bool rev[MS];
void New(int o) { s[o] = 1, h[o] = l[o] = r[o] = k[o] = rev[o] = 0; }
void Cal(int o) { if (!o) return; s[o] = s[l[o]] + s[r[o]] + 1; }
void Down(int o) { if (!o) return; int x; if (rev[o]) x = l[o], l[o] = r[o], r[o] = x, rev[o] ^= 1, rev[l[o]] ^= 1, rev[r[o]] ^= 1; }
void Splay(int x)
{
if (!x) return; int o = h[x]; Down(x);
while (o)
{
if (l[o] == x) { l[h[o]] == o ? l[h[o]] = x : r[h[o]] = x; h[x] = h[o]; l[o] = r[x]; h[r[x]] = o; r[x] = o, h[o] = x; Cal(o); }
else { l[h[o]] == o ? l[h[o]] = x : r[h[o]] = x; h[x] = h[o]; r[o] = l[x]; h[l[x]] = o; l[x] = o, h[o] = x; Cal(o); }
o = h[x];
}
Cal(x);
}
void Insert(int o, int n)
{
int ln = (n-1) / 2, rn = n-ln-1;
if (ln) { New(++now); h[now] = o, l[o] = now; Insert(now, ln); }
k[o] = ++c;
if (rn) { New(++now); h[now] = o, r[o] = now; Insert(now, rn); }
Cal(o);
}
void PrintP(int o) { Down(o); if (l[o]) PrintP(l[o]); if (!c) printf("%d", k[o]); else printf(" %d", k[o]); c++; if (r[o]) PrintP(r[o]); }
int FindRW(int rr) { int o = l[0]; Down(o); while (rr != s[l[o]]) { if (rr < s[l[o]]) o = l[o]; else rr -= s[l[o]] + 1, o = r[o]; Down(o); } return o; }
void Rev(int b, int n) { Splay(FindRW(b-1)); Splay(FindRW(b+n)); int o = r[l[l[0]]]; rev[o] ^= 1; Splay(o); }
void Print(int b, int n) { Splay(FindRW(b-1)); Splay(FindRW(b+n)); PrintP(r[l[l[0]]]); }
int main()
{
scanf("%d%d", &n, &m);
s[1] = s[2] = s[3] = 1; l[0] = 1, l[1] = 2, h[2] = 1, r[2] = 3, h[3] = 2; now = 3;
Insert(3, n); Cal(2); Cal(1);
rep(i, 1, m)
{
scanf("%d%d", &b, &e);
Rev(b, e-b+1);
}
c = 0; Print(1, n);
return 0;
}
I2luY2x1ZGUgPGNzdHJpbmc+CiNpbmNsdWRlIDxjbWF0aD4KI2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxmc3RyZWFtPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxjc3RkaW8+CiNpbmNsdWRlIDxxdWV1ZT4KCiNkZWZpbmUgcmVwKGksIGwsIHIpIGZvcihpbnQgaSA9IGw7IGkgPD0gcjsgaSsrKQojZGVmaW5lIGRvd24oaSwgbCwgcikgZm9yKGludCBpID0gbDsgaSA+PSByOyBpLS0pCiNkZWZpbmUgTVMgMTIzNDU2CiNkZWZpbmUgTUFYIDEwMzc0NzE4MjMKI2RlZmluZSBRIDEKCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbiwgbSwgc1tNU10sIGxbTVNdLCByW01TXSwgaFtNU10sIG5vdywga1tNU10sIGMsIGIsIGU7CmJvb2wgcmV2W01TXTsKCnZvaWQgTmV3KGludCBvKSB7IHNbb10gPSAxLCBoW29dID0gbFtvXSA9IHJbb10gPSBrW29dID0gcmV2W29dID0gMDsgfQoKdm9pZCBDYWwoaW50IG8pIHsgaWYgKCFvKSByZXR1cm47IHNbb10gPSBzW2xbb11dICsgc1tyW29dXSArIDE7IH0KCnZvaWQgRG93bihpbnQgbykgeyBpZiAoIW8pIHJldHVybjsgaW50IHg7IGlmIChyZXZbb10pIHggPSBsW29dLCBsW29dID0gcltvXSwgcltvXSA9IHgsIHJldltvXSBePSAxLCByZXZbbFtvXV0gXj0gMSwgcmV2W3Jbb11dI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