Python
from collections import deque
n = int(input())
array = deque()
answer = []
for i in range(n):
array.append(list(map(int,input().split())))
for i in range(len(array)):
point = 1
man = array.popleft()
for i in array:
if i[0] > man[0] and i[1] > man[1] :
point += 1
answer.append(point)
array.append(man)
print(*answer)