#include <bits/stdc++.h>
using namespace std;
const int N=100000+5;
const int M=200000;
int n,mx;
int a[N]={0},b[N]={0};
int p[M+5]={0};
int lowbit(int x){
return x&(-x);
}
void add(int x,int y){
for (int i=x;i<=mx;i+=lowbit(i)){
p[i]+=y;
}
return ;
}
int getsum(int x){
int t=0;
for (int i=x;i>0;i-=lowbit(i)){
t+=p[i];
}
return t;
}
int main(){
freopen ("EYOI_found.in","r",stdin);
freopen ("EYOI_found.out","w",stdout);
scanf("%d",&n);
for (int i=1;i<=n;i++){
scanf("%d%d",&a[i],&b[i]);
mx=max(mx,a[i]+b[i]);
}
for (int i=1;i<=n;i++){
int t=getsum(a[i]+b[i]-1);
if (t==0){
printf("0 ");
}
else{
int l=1,r=mx;
while(l<r){
int mid=(l+r)/2;
if (getsum(mid)<t)l=mid+1;
else r=mid;
}
printf("%d ",l);
}
add(a[i],1);
}
return 0;
}