#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
using PII=pair<ll,ll>;
using PIII=pair<int,pair<int,int>>;
const ld ESP = 1e-10;
const ld PI = acosl(-1);
const int N=1e6+10;
const int M=2e5+10;
// const int mod = 1000000007;
const int mod = 998244353;
//随机化
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<> dis(1, 1000000000);
void solve(){
int n,k;
cin>>n>>k;
vector<int> v;
int L=1,R=1,z=1;
deque<int> q;
for(int i=1;i<=k;i++){
int l,r;
cin>>l>>r;
while(R<=r){
if(z)q.push_back(R);
else q.push_front(R);
R++;
}
while(L<l){
if(z){
v.push_back(q.front());
q.pop_front();
}else{
v.push_back(q.back());
q.pop_back();
}
L++;
}
z^=1;
}
while(R<=n){
if(z)q.push_back(R);
else q.push_front(R);
R++;
}
while(L<=n){
if(z){
v.push_back(q.front());
q.pop_front();
}else{
v.push_back(q.back());
q.pop_back();
}
L++;
}
for(int i=0;i<v.size();i++){
cout<<v[i]<<" ";
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int _=1;
// cin>>_;
while(_--){
solve();
}
return 0;
}