import sys

class person:
	def __init__(self, weight:int, high:int):
		self.weight = weight
		self.high = high
		self.rank = 1

n = int(sys.stdin.readline().rstrip()) #개행문자까지 같이 받아서 rstrip 필수
lane = []

for i in range(0, n, 1):
	a, b = map(int, sys.stdin.readline().rstrip().split())# 공백 기준 나눠서 숫자로 변환
	lane.append(person(a, b))

	
for i in lane:
	for j in lane:
		if i == j: continue
		if (i.weight < j.weight) and (i.high < j.high):
			i.rank = i.rank+1
			
ans = ""
for l in lane:
	ans+=(str(l.rank)+" ")
print(ans)