#include <bits/stdc++.h>   using namespace std;   int x[100005], res[100005];   map<int, pair<int, int>> xhMap;   int main() {     memset(x, 0, sizeof(x));     memset(res, 0, sizeof(res));     int n = 0, a = 0, b = 0;     scanf( %d , &n);     for (int i = 0; i < n; ++i) {       scanf( %d%d , &a, &b);       x[i] = a;       xhMap[a] = make_pair(b, i);     }     sort(x, x + n);     for (int i = n - 1; i >= 0; --i) {       int tmp = x[i] + xhMap[x[i]].first - 1, idx = xhMap[x[i]].second;       int r = i + 1, num = 1;       while (r < n && x[r] <= tmp) {         num += res[xhMap[x[r]].second];         r += res[xhMap[x[r]].second];       }       res[idx] = num;     }     for (int i = 0; i < n; ++i) {       printf( %d  , res[i]);     }     return 0;   }   