#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
template <typename A>
ostream& operator<<(ostream& cout, vector<A> const& v);
template <typename A, typename B>
ostream& operator<<(ostream& cout, pair<A, B> const& p) {
  return cout << "(" << p.first << ", " << p.second << ")";
}
template <typename A>
ostream& operator<<(ostream& cout, vector<A> const& v) {
  cout << "[";
  for (int i = 0; i < v.size(); i++) {
    if (i) cout << ", ";
    cout << v[i];
  }
  return cout << "]";
}
mt19937 rng(steady_clock::now().time_since_epoch().count());
void usaco(string filename) {
#pragma message("be careful, freopen may be wrong")
  freopen((filename + ".in").c_str(), "r", stdin);
  freopen((filename + ".out").c_str(), "w", stdout);
}
const long long mod = 998244353;
long long madd(long long a, long long b) { return (a + b) % mod; }
long long msub(long long a, long long b) {
  return (((a - b) % mod) + mod) % mod;
}
long long mmul(long long a, long long b) {
  return ((a % mod) * (b % mod)) % mod;
}
long long mpow(long long base, long long exp) {
  long long res = 1;
  while (exp) {
    if (exp % 2 == 1) {
      res = (res * base) % mod;
    }
    exp >>= 1;
    base = (base * base) % mod;
  }
  return res;
}
long long minv(long long base) { return mpow(base, mod - 2); }
long long mdiv(long long a, long long b) { return mmul(a, minv(b)); }
long long gcd(long long x, long long y) {
  if (x == 0) return y;
  if (y == 0) return x;
  return gcd(y, x % y);
}
template <typename num_t>
struct segtree {
  int n, depth;
  vector<num_t> tree, lazy;
  void init(int second, long long* arr) {
    n = second;
    tree = vector<num_t>(4 * second, 0);
    lazy = vector<num_t>(4 * second, 0);
    init(0, 0, n - 1, arr);
  }
  num_t init(int i, int l, int r, long long* arr) {
    if (l == r) return tree[i] = arr[l];
    int mid = (l + r) / 2;
    num_t a = init(2 * i + 1, l, mid, arr),
          b = init(2 * i + 2, mid + 1, r, arr);
    return tree[i] = a.op(b);
  }
  void update(int l, int r, num_t v) {
    if (l > r) return;
    update(0, 0, n - 1, l, r, v);
  }
  num_t update(int i, int tl, int tr, int ql, int qr, num_t v) {
    eval_lazy(i, tl, tr);
    if (ql <= tl && tr <= qr) {
      lazy[i] = lazy[i].val + v.val;
      eval_lazy(i, tl, tr);
      return tree[i];
    }
    if (tl > tr || tr < ql || qr < tl) return tree[i];
    if (tl == tr) return tree[i];
    int mid = (tl + tr) / 2;
    num_t a = update(2 * i + 1, tl, mid, ql, qr, v),
          b = update(2 * i + 2, mid + 1, tr, ql, qr, v);
    return tree[i] = a.op(b);
  }
  num_t query(int l, int r) {
    if (l > r) return 0;
    return query(0, 0, n - 1, l, r);
  }
  num_t query(int i, int tl, int tr, int ql, int qr) {
    eval_lazy(i, tl, tr);
    if (ql <= tl && tr <= qr) return tree[i];
    if (tl > tr || tr < ql || qr < tl) return num_t::null_v;
    int mid = (tl + tr) / 2;
    num_t a = query(2 * i + 1, tl, mid, ql, qr),
          b = query(2 * i + 2, mid + 1, tr, ql, qr);
    return a.op(b);
  }
  void eval_lazy(int i, int l, int r) {
    tree[i] = tree[i].lazy_op(lazy[i], (r - l + 1));
    if (l != r) {
      lazy[i * 2 + 1] = lazy[i].val + lazy[i * 2 + 1].val;
      lazy[i * 2 + 2] = lazy[i].val + lazy[i * 2 + 2].val;
    }
    lazy[i] = num_t();
  }
};
struct max_t {
  long long val;
  static const long long null_v = -9223372036854775807LL;
  max_t() : val(0) {}
  max_t(long long v) : val(v) {}
  max_t op(max_t& other) { return max_t(max(val, other.val)); }
  max_t lazy_op(max_t v, int size) { return max_t(val + v.val); }
};
long long n, m, k, q, Q, T, l, r, x, y, z;
long long a[1000005];
long long b[1000005];
long long c[1000005];
string second, t;
long long ans = 0;
pair<pair<int, int>, int> xx[100005];
segtree<max_t> dp;
long long vans[100005];
int main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  };
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> xx[i].first.first >> xx[i].first.second;
    xx[i].second = i;
  }
  sort(xx, xx + n);
  memset(a, 0, sizeof(a));
  dp.init(n, a);
  reverse(xx, xx + n);
  for (long long i = 0; i < n; i++) {
    int l = 0, r = i;
    int tpos = xx[i].first.first + xx[i].first.second - 1;
    while (l < r) {
      int m = (l + r) / 2;
      int pos = xx[m].first.first;
      if (pos > tpos)
        l = m + 1;
      else
        r = m;
    }
    int cov = i + 1;
    long long val = dp.query(l, i - 1).val + cov;
    if (l == i) val = 1;
    dp.update(i, i, val - i - 1);
  }
  for (long long i = 0; i < n; i++)
    vans[xx[i].second] = dp.query(i, i).val + i + 1;
  {
    for (int ele = 0; ele < n; ele++) {
      if (ele) cout << " ";
      cout << vans[ele];
    }
    cout << '\n';
  };
}

### Prompt

Generate a Cpp solution to 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;
using namespace std::chrono;
template <typename A>
ostream& operator<<(ostream& cout, vector<A> const& v);
template <typename A, typename B>
ostream& operator<<(ostream& cout, pair<A, B> const& p) {
  return cout << "(" << p.first << ", " << p.second << ")";
}
template <typename A>
ostream& operator<<(ostream& cout, vector<A> const& v) {
  cout << "[";
  for (int i = 0; i < v.size(); i++) {
    if (i) cout << ", ";
    cout << v[i];
  }
  return cout << "]";
}
mt19937 rng(steady_clock::now().time_since_epoch().count());
void usaco(string filename) {
#pragma message("be careful, freopen may be wrong")
  freopen((filename + ".in").c_str(), "r", stdin);
  freopen((filename + ".out").c_str(), "w", stdout);
}
const long long mod = 998244353;
long long madd(long long a, long long b) { return (a + b) % mod; }
long long msub(long long a, long long b) {
  return (((a - b) % mod) + mod) % mod;
}
long long mmul(long long a, long long b) {
  return ((a % mod) * (b % mod)) % mod;
}
long long mpow(long long base, long long exp) {
  long long res = 1;
  while (exp) {
    if (exp % 2 == 1) {
      res = (res * base) % mod;
    }
    exp >>= 1;
    base = (base * base) % mod;
  }
  return res;
}
long long minv(long long base) { return mpow(base, mod - 2); }
long long mdiv(long long a, long long b) { return mmul(a, minv(b)); }
long long gcd(long long x, long long y) {
  if (x == 0) return y;
  if (y == 0) return x;
  return gcd(y, x % y);
}
template <typename num_t>
struct segtree {
  int n, depth;
  vector<num_t> tree, lazy;
  void init(int second, long long* arr) {
    n = second;
    tree = vector<num_t>(4 * second, 0);
    lazy = vector<num_t>(4 * second, 0);
    init(0, 0, n - 1, arr);
  }
  num_t init(int i, int l, int r, long long* arr) {
    if (l == r) return tree[i] = arr[l];
    int mid = (l + r) / 2;
    num_t a = init(2 * i + 1, l, mid, arr),
          b = init(2 * i + 2, mid + 1, r, arr);
    return tree[i] = a.op(b);
  }
  void update(int l, int r, num_t v) {
    if (l > r) return;
    update(0, 0, n - 1, l, r, v);
  }
  num_t update(int i, int tl, int tr, int ql, int qr, num_t v) {
    eval_lazy(i, tl, tr);
    if (ql <= tl && tr <= qr) {
      lazy[i] = lazy[i].val + v.val;
      eval_lazy(i, tl, tr);
      return tree[i];
    }
    if (tl > tr || tr < ql || qr < tl) return tree[i];
    if (tl == tr) return tree[i];
    int mid = (tl + tr) / 2;
    num_t a = update(2 * i + 1, tl, mid, ql, qr, v),
          b = update(2 * i + 2, mid + 1, tr, ql, qr, v);
    return tree[i] = a.op(b);
  }
  num_t query(int l, int r) {
    if (l > r) return 0;
    return query(0, 0, n - 1, l, r);
  }
  num_t query(int i, int tl, int tr, int ql, int qr) {
    eval_lazy(i, tl, tr);
    if (ql <= tl && tr <= qr) return tree[i];
    if (tl > tr || tr < ql || qr < tl) return num_t::null_v;
    int mid = (tl + tr) / 2;
    num_t a = query(2 * i + 1, tl, mid, ql, qr),
          b = query(2 * i + 2, mid + 1, tr, ql, qr);
    return a.op(b);
  }
  void eval_lazy(int i, int l, int r) {
    tree[i] = tree[i].lazy_op(lazy[i], (r - l + 1));
    if (l != r) {
      lazy[i * 2 + 1] = lazy[i].val + lazy[i * 2 + 1].val;
      lazy[i * 2 + 2] = lazy[i].val + lazy[i * 2 + 2].val;
    }
    lazy[i] = num_t();
  }
};
struct max_t {
  long long val;
  static const long long null_v = -9223372036854775807LL;
  max_t() : val(0) {}
  max_t(long long v) : val(v) {}
  max_t op(max_t& other) { return max_t(max(val, other.val)); }
  max_t lazy_op(max_t v, int size) { return max_t(val + v.val); }
};
long long n, m, k, q, Q, T, l, r, x, y, z;
long long a[1000005];
long long b[1000005];
long long c[1000005];
string second, t;
long long ans = 0;
pair<pair<int, int>, int> xx[100005];
segtree<max_t> dp;
long long vans[100005];
int main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  };
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> xx[i].first.first >> xx[i].first.second;
    xx[i].second = i;
  }
  sort(xx, xx + n);
  memset(a, 0, sizeof(a));
  dp.init(n, a);
  reverse(xx, xx + n);
  for (long long i = 0; i < n; i++) {
    int l = 0, r = i;
    int tpos = xx[i].first.first + xx[i].first.second - 1;
    while (l < r) {
      int m = (l + r) / 2;
      int pos = xx[m].first.first;
      if (pos > tpos)
        l = m + 1;
      else
        r = m;
    }
    int cov = i + 1;
    long long val = dp.query(l, i - 1).val + cov;
    if (l == i) val = 1;
    dp.update(i, i, val - i - 1);
  }
  for (long long i = 0; i < n; i++)
    vans[xx[i].second] = dp.query(i, i).val + i + 1;
  {
    for (int ele = 0; ele < n; ele++) {
      if (ele) cout << " ";
      cout << vans[ele];
    }
    cout << '\n';
  };
}

```