Problem: Input

The input is given from Standard Input in the following format:


> $N \ Q$ $a_1 \ b_1$ $a_2 \ b_2$ $ ： \ ： $ $a_Q \ b_Q$

Output

* You have to print $N$ lines.
* The $i$-th line should contain the number of dishes of sushi had eaten for customer $i (1 \le i \le N)$.



Constraints

* $3 \le N, Q \le 100,000$
* $1 \le a_i \le N$
* $1 \le b_i \le 10^{12}$
* Any final results do not exceed $2 \times 10^{13}$.



Subtasks

Subtask 1 [ $60$ points ]


* $N, Q \le 100$
* $b_i = 1$

Subtask 2 [ $400$ points ]


* $N, Q \le 100$
* $b_i \le 10^{12}$

Subtask 3 [ $240$ points ]


* $N, Q \le 100,000$
* $b_i = 1$

Subtask 4 [ $500$ points ]


* There are no additional constraints.

Output

* You have to print $N$ lines.
* The $i$-th line should contain the number of dishes of sushi had eaten for customer $i (1 \le i \le N)$.



Constraints

* $3 \le N, Q \le 100,000$
* $1 \le a_i \le N$
* $1 \le b_i \le 10^{12}$
* Any final results do not exceed $2 \times 10^{13}$.



Subtasks

Subtask 1 [ $60$ points ]


* $N, Q \le 100$
* $b_i = 1$

Subtask 2 [ $400$ points ]


* $N, Q \le 100$
* $b_i \le 10^{12}$

Subtask 3 [ $240$ points ]


* $N, Q \le 100,000$
* $b_i = 1$

Subtask 4 [ $500$ points ]


* There are no additional constraints.

Input

The input is given from Standard Input in the following format:


> $N \ Q$ $a_1 \ b_1$ $a_2 \ b_2$ $ ： \ ： $ $a_Q \ b_Q$

Examples

Input

9 3
5 11
8 4
4 7


Output

4
4
4
4
2
2
1
1
0


Input

6 6
3 5
6 11
1 6
4 7
5 2
2 5


Output

10
10
5
5
4
2


Input

5 6
1 1
2 1
3 1
1 1
5 1
3 1


Output

2
2
1
1
0


Input

10 10
10 10
9 20
8 30
7 40
6 50
5 60
4 70
3 80
2 90
1 100


Output

223
123
77
50
33
21
12
7
3
1

Solution (in CPP):

Solution:
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
typedef pair<P, long long> P2;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF (1LL<<60)
#define MOD 1000000007

int N, Q;
long long A[100000];
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> Q;
  set<P2> S;
  S.insert(P2(P(0, N-1), 0));
  rep(i, Q) {
    int a;
    long long b;
    cin >> a >> b;
    a--;
    auto it = --S.upper_bound(P2(P(a+1, -1), -1));
    P2 p = *it;
    if (p._1._2 > a) {
      S.erase(it);
      S.insert(P2(P(a+1, p._1._2), p._2));
      it = S.insert(P2(P(p._1._1, a), p._2))._1;
    }
    while (true) {
      P2 cur = *it;
      long long w = cur._1._2-cur._1._1+1;
      long long lim = INF;
      if (it != S.begin()) {
        lim = (--it)->_2 - cur._2;
        it++;
      }
      long long up = min(lim, b/w);
      cur._2 += up;
      b -= 1LL*up*w;
      if (it != S.begin() && up == lim) {
        it = S.erase(it);
        int left = (--it)->_1._1;
        S.erase(it);
        it = S.insert(P2(P(left, a), cur._2))._1;
      }
      else {
        S.erase(it);
        it = S.insert(cur)._1;
        break;
      }
    }
    if (b > 0) {
      P2 cur = *it;
      int left = it->_1._1, border = left+b;
      S.erase(it);
      S.insert(P2(P(left, border-1), cur._2+1));
      S.insert(P2(P(border, a), cur._2));
    }
  }
  for (P2 p : S) {
    int l = p._1._1, r = p._1._2;
    long long val = p._2;
    for (int i=l; i<=r; i++) A[i] = val;
  }
  rep(i, N) cout << A[i] << "\n";
  return 0;
}