#include <bits/stdc++.h>
const int MAX = 2000020;
int n, m;
int BIT[MAX];
int get(int pos) {
  int ret = 0;
  while (pos) {
    ret += BIT[pos];
    pos -= pos & -pos;
  }
  return ret;
}
void update(int pos, int val) {
  while (pos < MAX) {
    BIT[pos] += val;
    pos += pos & -pos;
  }
}
int pos[MAX], last, match[MAX];
bool used[MAX];
void solve() {
  last = n;
  int i;
  for (i = 1; i <= n; i++) {
    update(i, 1);
    pos[i] = i;
  }
  int query;
  for (query = 0; query < m; query++) {
    int num, at;
    scanf("%d%d", &num, &at);
    int l = 0, r = last, m;
    while (l <= r) {
      m = (l + r) >> 1;
      if (get(m) >= n - at + 1)
        r = m - 1;
      else
        l = m + 1;
    }
    int index = r + 1;
    if ((match[pos[index]] == 0 && !used[num]) || match[pos[index]] == num) {
      used[num] = 1;
      match[pos[index]] = num;
      update(index, -1);
      pos[++last] = pos[index];
      pos[index] = 0;
      update(last, 1);
    } else {
      puts("-1");
      return;
    }
  }
  int j = 1;
  for (i = n; i >= 1; i--) {
    if (match[i])
      printf("%d ", match[i]);
    else {
      while (used[j]) j++;
      printf("%d ", j++);
    }
  }
  puts("");
}
int main() {
  scanf("%d%d", &n, &m);
  solve();
  return 0;
}

### Prompt

In CPP, your task is to solve the following problem:

The employees of the F company have lots of ways to entertain themselves. Today they invited a famous magician who shows a trick with plastic cups and a marble.

The point is to trick the spectator's attention. Initially, the spectator stands in front of a line of n plastic cups. Then the magician places a small marble under one cup and shuffles the cups. Then the spectator should guess which cup hides the marble.

But the head coder of the F company isn't easy to trick. When he saw the performance, he noticed several important facts:

  * each cup contains a mark — a number from 1 to n; all marks on the cups are distinct; 
  * the magician shuffles the cups in m operations, each operation looks like that: take a cup marked xi, sitting at position yi in the row of cups (the positions are numbered from left to right, starting from 1) and shift it to the very beginning of the cup row (on the first position). 



When the head coder came home after work he wanted to re-do the trick. Unfortunately, he didn't remember the starting or the final position of the cups. He only remembered which operations the magician performed. Help the coder: given the operations in the order they were made find at least one initial permutation of the cups that can go through the described operations in the given order. Otherwise, state that such permutation doesn't exist.

Input

The first line contains integers n and m (1 ≤ n, m ≤ 106). Each of the next m lines contains a couple of integers. The i-th line contains integers xi, yi (1 ≤ xi, yi ≤ n) — the description of the i-th operation of the magician. Note that the operations are given in the order in which the magician made them and the coder wants to make them in the same order.

Output

If the described permutation doesn't exist (the programmer remembered wrong operations), print -1. Otherwise, print n distinct integers, each from 1 to n: the i-th number should represent the mark on the cup that initially is in the row in position i.

If there are multiple correct answers, you should print the lexicographically minimum one.

Examples

Input

2 1
2 1


Output

2 1 


Input

3 2
1 2
1 1


Output

2 1 3 


Input

3 3
1 3
2 3
1 3


Output

-1

### Response

```cpp
#include <bits/stdc++.h>
const int MAX = 2000020;
int n, m;
int BIT[MAX];
int get(int pos) {
  int ret = 0;
  while (pos) {
    ret += BIT[pos];
    pos -= pos & -pos;
  }
  return ret;
}
void update(int pos, int val) {
  while (pos < MAX) {
    BIT[pos] += val;
    pos += pos & -pos;
  }
}
int pos[MAX], last, match[MAX];
bool used[MAX];
void solve() {
  last = n;
  int i;
  for (i = 1; i <= n; i++) {
    update(i, 1);
    pos[i] = i;
  }
  int query;
  for (query = 0; query < m; query++) {
    int num, at;
    scanf("%d%d", &num, &at);
    int l = 0, r = last, m;
    while (l <= r) {
      m = (l + r) >> 1;
      if (get(m) >= n - at + 1)
        r = m - 1;
      else
        l = m + 1;
    }
    int index = r + 1;
    if ((match[pos[index]] == 0 && !used[num]) || match[pos[index]] == num) {
      used[num] = 1;
      match[pos[index]] = num;
      update(index, -1);
      pos[++last] = pos[index];
      pos[index] = 0;
      update(last, 1);
    } else {
      puts("-1");
      return;
    }
  }
  int j = 1;
  for (i = n; i >= 1; i--) {
    if (match[i])
      printf("%d ", match[i]);
    else {
      while (used[j]) j++;
      printf("%d ", j++);
    }
  }
  puts("");
}
int main() {
  scanf("%d%d", &n, &m);
  solve();
  return 0;
}

```