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 *x*<sub class="lower-index">*i*</sub> and the height *h*<sub class="lower-index">*i*</sub>. 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].
The first line contains integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>) which is the number of dominoes. Then follow *n* lines containing two integers *x*<sub class="lower-index">*i*</sub> and *h*<sub class="lower-index">*i*</sub> ( - 10<sup class="upper-index">8</sup> ≤ *x*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">8</sup>, 2 ≤ *h*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">8</sup>) each, which are the coordinate and height of every domino. No two dominoes stand on one point.
import os
import sys
from io import BytesIO, IOBase
 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
	newlines = 0
	
	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = "x" in file.mode or "r" not in file.mode
		self.write = self.buffer.write if self.writable else None
	
	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines = 0
		return self.buffer.read()
	
	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b"\n")+(not b)
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines -= 1
		return self.buffer.readline()
	
	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s:self.buffer.write(s.encode("ascii"))
		self.read = lambda:self.buffer.read().decode("ascii")
		self.readline = lambda:self.buffer.readline().decode("ascii")
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda:sys.stdin.readline().rstrip("\r\n")

n=int(input())
arr=[0 for i in range(n)]
 
for i in range(n):
    x,h=map(int,input().split())
    arr[i]=[x,h,i]
 
arr.sort(key=lambda x:x[0])
 
ans=[0 for i in range(n)]
 
arr_to_tree=[0 for i in range(n)]
def build(node,start,end):
 
    if start==end:
        arr_to_tree[start]=node
        tree[node][0]=arr[start][0]
        tree[node][1]=arr[start][0]
        tree[node][2]=start
        return
    mid=start+(end-start)//2
    build(node*2,start,mid)
    build(node*2+1,mid+1,end)
    tree[node][2]=max(tree[node*2][2],tree[node*2+1][2])
    tree[node][1]=tree[node*2+1][1]
    tree[node][0]=tree[node*2][0]
 
tree=[[0,0,0] for i in range(4*n)]
build(1,0,n-1)
 
def query(node,l,r):
    if l>tree[node][1] or r<tree[node][0]:
        return 0
    if l<=tree[node][0] and tree[node][1]<=r:
        return tree[node][2]
    left=query(node*2,l,r)
    right=query(node*2+1,l,r)
    return max(left,right)
 
def update(node,val):
    tree[node][2]=val
    while node!=1:
        node//=2
        tree[node][2]=max(tree[node*2][2],tree[node*2+1][2])
for i in range(n-1,-1,-1):
    mnr=arr[i][0]
    mxr=arr[i][0]+arr[i][1]-1
    
    mx_index=query(1,mnr,mxr)
    update(arr_to_tree[i],mx_index)
    ans[arr[i][2]]=mx_index-i+1
 
print(*ans)