N = int(input())
people = []
for _ in range(N):
    w, h = map(int, input().split())
    people.append((w, h))
for c in people:
    rank = 1
    for n in people:
        if (c[0] != n[0]) & (c[1] != n[1]):
            if (c[0] < n[0]) & (c[1] < n[1]):
                rank += 1
    print(rank)

0e99454af9aa1e3830444c522c1074c247a540d7
<mask token>

<mask token>
for _ in range(N):
    w, h = map(int, input().split())
    people.append((w, h))
for c in people:
    rank = 1
    for n in people:
        if (c[0] != n[0]) & (c[1] != n[1]):
            if (c[0] < n[0]) & (c[1] < n[1]):
                rank += 1
    print(rank)

N = int(input())
people = []
for _ in range(N):
    w, h = map(int, input().split())
    people.append((w, h))
for c in people:
    rank = 1
    for n in people:
        if (c[0] != n[0]) & (c[1] != n[1]):
            if (c[0] < n[0]) & (c[1] < n[1]):
                rank += 1
    print(rank)
