n = int(input())
chk = []
for i in range(n):
    s, p = map(str, input().split())
    p = int(p)
    chk.append([s, -p])
s = sorted(chk)
#print(s)
#print(chk)
for i in s:
    print(chk.index(i)+1) n = int(input()) n int(input()) int input() input chk = [] chk [] for i in range(n):
    s, p = map(str, input().split())
    p = int(p)
    chk.append([s, -p]) i range(n) range n s, p = map(str, input().split()) s map(str, input().split()) map str input().split() ().split () input split p p = int(p) p int(p) int p chk.append([s, -p]) chk.append chk append [s, -p] s -p p s = sorted(chk) s sorted(chk) sorted chk for i in s:
    print(chk.index(i)+1) i s print(chk.index(i)+1) print chk.index(i)+1 chk.index(i) chk.index chk index i 1 n = int(input()) int(input()) n p = map(str, input().split()) map(str, input().split()) p chk = [] [] chk s, p = map(str, input().split()) map(str, input().split()) s s = sorted(chk) sorted(chk) s p = int(p) int(p) p
n = int(input())
chk = []
for i in range(n):
    s, p = map(str, input().split())
    p = int(p)
    chk.append([s, -p])
s = sorted(chk)
#print(s)
#print(chk)
for i in s:
    print(chk.index(i)+1)