n = int(input())
l = []
for i in range(n):
    sp = input().split()
    l.append((sp[0], int(sp[1]), i+1))

a = sorted(l, key=lambda i: i[1], reverse=True)
a = sorted(a, key=lambda i: i[0])

for i in range(n):
    print(a[i][2]) n = int(input()) n int(input()) int input() input l = [] l [] for i in range(n):
    sp = input().split()
    l.append((sp[0], int(sp[1]), i+1)) i range(n) range n sp = input().split() sp input().split() ().split () input split l.append((sp[0], int(sp[1]), i+1)) l.append l append (sp[0], int(sp[1]), i+1) sp[0] sp 0 int(sp[1]) int sp[1] sp 1 i+1 i 1 a = sorted(l, key=lambda i: i[1], reverse=True) a sorted(l, key=lambda i: i[1], reverse=True) sorted l key=lambda i: i[1] key lambda i: i[1] i[1] i 1 i reverse=True reverse True a = sorted(a, key=lambda i: i[0]) a sorted(a, key=lambda i: i[0]) sorted a key=lambda i: i[0] key lambda i: i[0] i[0] i 0 i for i in range(n):
    print(a[i][2]) i range(n) range n print(a[i][2]) print a[i][2] [i] a i 2 n = int(input()) int(input()) n sp = input().split() input().split() sp a = sorted(l, key=lambda i: i[1], reverse=True) sorted(l, key=lambda i: i[1], reverse=True) a l = [] [] l a = sorted(a, key=lambda i: i[0]) sorted(a, key=lambda i: i[0]) a
n = int(input())
l = []
for i in range(n):
    sp = input().split()
    l.append((sp[0], int(sp[1]), i+1))

a = sorted(l, key=lambda i: i[1], reverse=True)
a = sorted(a, key=lambda i: i[0])

for i in range(n):
    print(a[i][2])