原题链接
#include<bits/stdc++.h>
#define LL long long
#define INF INT64_MAX
#define MOD 998244353
#define ls rt<<1
#define rs rt<<1 | 1
using namespace std;
typedef pair<int,int>pa;
const int N = 1000005;
struct node{
int p, x;
}a[N];
bool cmp(node q, node w){return q.p < w.p;}
int v[N], b[N];
int main(){
int n ,k, fla = 1;
scanf("%d%d", &n, &k);
for(int i = 1;i <= k;i++){
scanf("%d%d", &a[i].p, &a[i].x);
if(a[i].p-a[i-1].p+a[i-1].x < a[i].x) fla=0;
b[a[i].p] = a[i].x;
v[a[i].x]++;
}
sort(a+1, a+1+k, cmp);
a[k+1].p = n+1;
for(int i = 0;i <= k;i++){
int cnt = a[i].x;
for(int j = a[i].p+1;j < a[i+1].p;j++){
b[j] = ++cnt;
v[cnt]++;
}
}
for(int i = 1;i <= n;i++)
v[i] += v[i-1];
if(fla){
for(int i = 1;i < n;i++) printf("%d ", v[b[i]]--);
printf("%d", v[b[n]]--);
}
else printf("-1");
return 0;
}