#include<bits/stdc++.h>
using namespace std;
struct Node{
int l,r,key,val,len,bj=0;
}a[100001];
int tot=0,rot,ans=0,m,bj=0,js;
void push_up(int p){
a[p].len=a[a[p].l].len+a[a[p].r].len+1;
}
void push_down(int now){
if(a[now].bj){
a[a[now].l].bj^=1;
a[a[now].r].bj^=1;
swap(a[now].l,a[now].r);
a[now].bj=0;
}
}
int merge(int rot1,int rot2){
if(rot1==0){
return rot2;
}
else if(rot2==0){
return rot1;
}
if(a[rot1].key<a[rot2].key){
push_down(rot1);
a[rot1].r=merge(a[rot1].r,rot2);
push_up(rot1);
return rot1;
}
else{
push_down(rot2);
a[rot2].l=merge(rot1,a[rot2].l);
push_up(rot2);
return rot2;
}
}
void val_split(int now,int k,int &rot1,int &rot2){
if(now==0){
rot1=0;
rot2=0;
return;
}
else if(a[now].val<=k){
rot1=now;
val_split(a[rot1].r,k,a[rot1].r,rot2);
}
else{
rot2=now;
val_split(a[rot2].l,k,rot1,a[rot2].l);
}
push_up(now);
}
void k_split(int now,int k,int &rot1,int &rot2){
if(now==0){
rot1=0;
rot2=0;
return;
}
push_down(now);
if(a[a[now].l].len<k){
rot1=now;
k_split(a[rot1].r,k-a[a[rot1].l].len-1,a[rot1].r,rot2);
}
else{
rot2=now;
k_split(a[rot2].l,k,rot1,a[rot2].l);
}
push_up(now);
}
void New_Node(int val){
if(val<m){
js--;
return;
}
a[++tot].key=rand()%1145145+1;
a[tot].l=0;
a[tot].r=0;
int rot1,rot2,now=tot;
a[tot].len=1;
a[tot].val=val;
val_split(rot,val,rot1,rot2);
rot=merge(merge(rot1,now),rot2);
}
void work(int l,int r){
int rot1,rot2,rot3,rot4;
k_split(rot,l-1,rot1,rot2);
k_split(rot2,r-l+1,rot3,rot4);
a[rot3].bj^=1;
rot=merge(rot1,merge(rot3,rot4));
}
void read(int &x){
x=0;
int f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-'){
f=-f;
}
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x*=10;
x+=ch-'0';
ch=getchar();
}
x*=f;
}
void dfs(int i){
if(i==0){
return;
}
push_down(i);
dfs(a[i].l);
printf("%d ",a[i].val);
dfs(a[i].r);
}
int main(){
srand(time(NULL));
int n;
read(n);
read(m);
for(int i=1;i<=n;i++){
New_Node(i);
}
for(int i=1;i<=m;i++){
int l,r;
read(l);
read(r);
work(l,r);
}
dfs(rot);
return 0;
}