#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long int INFLL = 1e18;
const double EPS = 1e-7;
template <class T>
T &chmin(T &a, const T &b) {
  return a = min(a, b);
}
template <class T>
T &chmax(T &a, const T &b) {
  return a = max(a, b);
}
int in() {
  int a;
  cin >> a;
  return a;
}
const int RMQ_MAX_N = 200000 * 4;
const long long int RMQ_INIT = 0;
const long long int RMQ_NONE = 0;
struct RMQ {
  long long int node[RMQ_MAX_N];
  int idnode[RMQ_MAX_N];
  int size;
  bool com(long long int a, long long int b) { return a > b; }
  long long int cho(long long int a, long long int b) {
    return com(a, b) ? a : b;
  }
  void init(int n) {
    size = 1;
    while (size < n) size *= 2;
    for (int i = size * 2 - 2; i >= 0; i--) {
      node[i] = RMQ_INIT;
      if (i >= size - 1)
        idnode[i] = i - size + 1;
      else
        idnode[i] = idnode[i * 2 + 1];
    }
    node[size * 2] = RMQ_NONE;
  }
  void update(int k, long long int x) {
    k += size - 1;
    node[k] = x;
    while (k > 0) {
      k = (k - 1) / 2;
      if (com(node[k * 2 + 1], node[k * 2 + 2])) {
        node[k] = node[k * 2 + 1];
        idnode[k] = idnode[k * 2 + 1];
      } else {
        node[k] = node[k * 2 + 2];
        idnode[k] = idnode[k * 2 + 2];
      }
    }
  }
  long long int query(int a, int b, int k = 0, int l = 0, int r = 0,
                      bool f = true) {
    if (f) r = size;
    if (a <= l && r <= b) {
      return node[k];
    } else if (b <= l || r <= a) {
      return RMQ_NONE;
    } else {
      long long int chl = query(a, b, k * 2 + 1, l, (l + r) / 2, false);
      long long int chr = query(a, b, k * 2 + 2, (l + r) / 2, r, false);
      return cho(chl, chr);
    }
  }
  int idquery(int a, int b, int k = 0, int l = 0, int r = 0, bool f = true) {
    if (f) r = size;
    if (a <= l && r <= b) {
      return idnode[k];
    } else if (b <= l || r <= a) {
      return size + 1;
    } else {
      int chl = idquery(a, b, k * 2 + 1, l, (l + r) / 2, false);
      int chr = idquery(a, b, k * 2 + 2, (l + r) / 2, r, false);
      return com(node[chl + size - 1], node[chr + size - 1]) ? chl : chr;
    }
  }
};
const int MAX_N = 100010;
vector<pair<pair<int, int>, int> > v;
RMQ seg;
int ans[MAX_N];
int main() {
  int n;
  cin >> n;
  for (int i = (0); i < (int)(n); i++) {
    int x, h;
    cin >> x >> h;
    v.push_back(pair<pair<int, int>, int>(pair<int, int>(x, h), i));
  }
  sort((v).begin(), (v).end());
  seg.init(n);
  for (int i = (0); i < (int)(n); i++) {
    seg.update(i, i);
  }
  for (int i = n - 1; i >= 0; i--) {
    int pos =
        lower_bound(
            (v).begin(), (v).end(),
            pair<pair<int, int>, int>(
                pair<int, int>(v[i].first.first + v[i].first.second, -INF),
                -INF)) -
        v.begin();
    int res = seg.query(i, pos);
    ans[v[i].second] = res - i + 1;
    seg.update(i, res);
  }
  for (int i = (0); i < (int)(n); i++) {
    if (i != 0) cout << " ";
    cout << ans[i];
  }
  cout << "\n";
}

### Prompt

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

Vasya is interested in arranging dominoes. He is fed up with common dominoes and he uses the dominoes of different heights. He put n dominoes on the table along one axis, going from left to right. Every domino stands perpendicular to that axis so that the axis passes through the center of its base. The i-th domino has the coordinate xi and the height hi. Now Vasya wants to learn for every domino, how many dominoes will fall if he pushes it to the right. Help him do that. 

Consider that a domino falls if it is touched strictly above the base. In other words, the fall of the domino with the initial coordinate x and height h leads to the fall of all dominoes on the segment [x + 1, x + h - 1].

<image>

Input

The first line contains integer n (1 ≤ n ≤ 105) which is the number of dominoes. Then follow n lines containing two integers xi and hi ( - 108 ≤ xi ≤ 108, 2 ≤ hi ≤ 108) each, which are the coordinate and height of every domino. No two dominoes stand on one point.

Output

Print n space-separated numbers zi — the number of dominoes that will fall if Vasya pushes the i-th domino to the right (including the domino itself).

Examples

Input

4
16 5
20 5
10 10
18 2


Output

3 1 4 1 

Input

4
0 10
1 5
9 10
15 10


Output

4 1 2 1 

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long int INFLL = 1e18;
const double EPS = 1e-7;
template <class T>
T &chmin(T &a, const T &b) {
  return a = min(a, b);
}
template <class T>
T &chmax(T &a, const T &b) {
  return a = max(a, b);
}
int in() {
  int a;
  cin >> a;
  return a;
}
const int RMQ_MAX_N = 200000 * 4;
const long long int RMQ_INIT = 0;
const long long int RMQ_NONE = 0;
struct RMQ {
  long long int node[RMQ_MAX_N];
  int idnode[RMQ_MAX_N];
  int size;
  bool com(long long int a, long long int b) { return a > b; }
  long long int cho(long long int a, long long int b) {
    return com(a, b) ? a : b;
  }
  void init(int n) {
    size = 1;
    while (size < n) size *= 2;
    for (int i = size * 2 - 2; i >= 0; i--) {
      node[i] = RMQ_INIT;
      if (i >= size - 1)
        idnode[i] = i - size + 1;
      else
        idnode[i] = idnode[i * 2 + 1];
    }
    node[size * 2] = RMQ_NONE;
  }
  void update(int k, long long int x) {
    k += size - 1;
    node[k] = x;
    while (k > 0) {
      k = (k - 1) / 2;
      if (com(node[k * 2 + 1], node[k * 2 + 2])) {
        node[k] = node[k * 2 + 1];
        idnode[k] = idnode[k * 2 + 1];
      } else {
        node[k] = node[k * 2 + 2];
        idnode[k] = idnode[k * 2 + 2];
      }
    }
  }
  long long int query(int a, int b, int k = 0, int l = 0, int r = 0,
                      bool f = true) {
    if (f) r = size;
    if (a <= l && r <= b) {
      return node[k];
    } else if (b <= l || r <= a) {
      return RMQ_NONE;
    } else {
      long long int chl = query(a, b, k * 2 + 1, l, (l + r) / 2, false);
      long long int chr = query(a, b, k * 2 + 2, (l + r) / 2, r, false);
      return cho(chl, chr);
    }
  }
  int idquery(int a, int b, int k = 0, int l = 0, int r = 0, bool f = true) {
    if (f) r = size;
    if (a <= l && r <= b) {
      return idnode[k];
    } else if (b <= l || r <= a) {
      return size + 1;
    } else {
      int chl = idquery(a, b, k * 2 + 1, l, (l + r) / 2, false);
      int chr = idquery(a, b, k * 2 + 2, (l + r) / 2, r, false);
      return com(node[chl + size - 1], node[chr + size - 1]) ? chl : chr;
    }
  }
};
const int MAX_N = 100010;
vector<pair<pair<int, int>, int> > v;
RMQ seg;
int ans[MAX_N];
int main() {
  int n;
  cin >> n;
  for (int i = (0); i < (int)(n); i++) {
    int x, h;
    cin >> x >> h;
    v.push_back(pair<pair<int, int>, int>(pair<int, int>(x, h), i));
  }
  sort((v).begin(), (v).end());
  seg.init(n);
  for (int i = (0); i < (int)(n); i++) {
    seg.update(i, i);
  }
  for (int i = n - 1; i >= 0; i--) {
    int pos =
        lower_bound(
            (v).begin(), (v).end(),
            pair<pair<int, int>, int>(
                pair<int, int>(v[i].first.first + v[i].first.second, -INF),
                -INF)) -
        v.begin();
    int res = seg.query(i, pos);
    ans[v[i].second] = res - i + 1;
    seg.update(i, res);
  }
  for (int i = (0); i < (int)(n); i++) {
    if (i != 0) cout << " ";
    cout << ans[i];
  }
  cout << "\n";
}

```