#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
#define ll long long
#define db double
#define ull unsigned long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 1e5+5;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
int a[maxn],n,b[maxn],tmp[maxn];
int tr[maxn<<2];
void build(int id,int l,int r)
{
tr[id] = 0;
if(l==r) {tr[id]=1;return ;}
int mid = (l+r)>>1;
build(id<<1,l,mid);build(id<<1|1,mid+1,r);
tr[id] = tr[id<<1] + tr[id<<1|1];
}
void update(int id,int stl,int str,int pos)
{
if(stl==str){
tr[id] = 0;
return ;
}
int mid = (stl+str)>>1;
if(pos<=mid) update(id<<1,stl,mid,pos);
else update(id<<1|1,mid+1,str,pos);
tr[id] = tr[id<<1] + tr[id<<1|1];
}
int query(int id,int stl,int str,int l,int r)
{
if(stl==l && str==r){
return tr[id];
}
int mid = (stl+str)>>1;
if(r<=mid) return query(id<<1,stl,mid,l,r);
else if(l>mid) return query(id<<1|1,mid+1,str,l,r);
else return query(id<<1,stl,mid,l,mid) + query(id<<1|1,mid+1,str,mid+1,r);
}
int query2(int id,int l,int r,int k)
{
if(l==r) return l;
int mid = (l+r)>>1;
if(tr[id<<1]>=k) return query2(id<<1,l,mid,k);
else return query2(id<<1|1,mid+1,r,k-tr[id<<1]);
}
void perm(int *a,int *b,int x)
{
while(x){
if(x&1){
rep(i,1,n) tmp[i] = a[b[i]];
rep(i,1,n) a[i] = tmp[i];
}
rep(i,1,n) tmp[i] = b[b[i]];
rep(i,1,n) b[i] = tmp[i];
x>>=1;
}
}
int main()
{
fastio(); int m,k,x;
cin>>n>>m;
rep(i,1,n) a[i] = i;
while(m--){
cin>>k>>x;
build(1,1,n);
int last = 0;
rep(i,1,n){
int r = last==n?0:query(1,1,n,last+1,n);
if(r>=k){
int pre = last?query(1,1,n,1,last):0;
b[i] = query2(1,1,n,k+pre);
update(1,1,n,b[i]);
last = b[i];
}else{
int tt = k - r;
tt %= (n-i+1);
if(tt == 0) tt = n-i+1;
b[i] = query2(1,1,n,tt);
update(1,1,n,b[i]);
last = b[i];
}
}
perm(a,b,x);
}
rep(i,1,n) cout<<a[i]<<" \n"[i==n];
return 0;
}