n = int(input())
res = []
for i in range(1, n+1):
    s, p = input().split()
    res.append((s, -int(p), i))

res.sort()
for _, _, i in res:
    print(i) n = int(input()) n int(input()) int input() input res = [] res [] for i in range(1, n+1):
    s, p = input().split()
    res.append((s, -int(p), i)) i range(1, n+1) range 1 n+1 n 1 s, p = input().split() s input().split() ().split () input split p res.append((s, -int(p), i)) res.append res append (s, -int(p), i) s -int(p) int(p) int p i res.sort() res.sort res sort for _, _, i in res:
    print(i) _ _ i res print(i) print i p = input().split() input().split() p res = [] [] res s, p = input().split() input().split() s n = int(input()) int(input()) n
n = int(input())
res = []
for i in range(1, n+1):
    s, p = input().split()
    res.append((s, -int(p), i))

res.sort()
for _, _, i in res:
    print(i)
