n = int(input())
sp = [0] * n
for i in range(n):
    sp[i] = list(map(str,input().split()))
sp_sorted = sorted(sp, key=lambda x: int(x[1]), reverse=True)
sp_sorted_sorted = sorted(sp_sorted, key=lambda x: x[0])
for i in range(n):
    for j in range(n):
        if sp_sorted_sorted[i] == sp[j]:
            print(j+1) n = int(input()) n int(input()) int input() input sp = [0] * n sp [0] * n [0] 0 n for i in range(n):
    sp[i] = list(map(str,input().split())) i range(n) range n sp[i] = list(map(str,input().split())) sp[i] sp i list(map(str,input().split())) list map(str,input().split()) map str input().split() ().split () input split sp_sorted = sorted(sp, key=lambda x: int(x[1]), reverse=True) sp_sorted sorted(sp, key=lambda x: int(x[1]), reverse=True) sorted sp key=lambda x: int(x[1]) key lambda x: int(x[1]) int(x[1]) int x[1] x 1 x reverse=True reverse True sp_sorted_sorted = sorted(sp_sorted, key=lambda x: x[0]) sp_sorted_sorted sorted(sp_sorted, key=lambda x: x[0]) sorted sp_sorted key=lambda x: x[0] key lambda x: x[0] x[0] x 0 x for i in range(n):
    for j in range(n):
        if sp_sorted_sorted[i] == sp[j]:
            print(j+1) i range(n) range n for j in range(n):
        if sp_sorted_sorted[i] == sp[j]:
            print(j+1) j range(n) range n if sp_sorted_sorted[i] == sp[j]:
            print(j+1) sp_sorted_sorted[i] == sp[j] sp_sorted_sorted[i] sp_sorted_sorted i sp[j] sp j print(j+1) print j+1 j 1 sp_sorted = sorted(sp, key=lambda x: int(x[1]), reverse=True) sorted(sp, key=lambda x: int(x[1]), reverse=True) sp_sorted n = int(input()) int(input()) n sp = [0] * n [0] * n sp sp_sorted_sorted = sorted(sp_sorted, key=lambda x: x[0]) sorted(sp_sorted, key=lambda x: x[0]) sp_sorted_sorted
n = int(input())
sp = [0] * n
for i in range(n):
    sp[i] = list(map(str,input().split()))
sp_sorted = sorted(sp, key=lambda x: int(x[1]), reverse=True)
sp_sorted_sorted = sorted(sp_sorted, key=lambda x: x[0])
for i in range(n):
    for j in range(n):
        if sp_sorted_sorted[i] == sp[j]:
            print(j+1)