n = int(input())
x = [input().split() for i in range(n)]
for i in range(n):
    x[i][1] = int(x[i][1])
    x[i].append(i+1)

x.sort(key= lambda a: a[1])
x.reverse()
x.sort(key= lambda b: b[0])

for i in range(n):
    print(x[i][2]) n = int(input()) n int(input()) int input() input input().split() for i in range(n) for i in range(n) i range(n) range n for i in range(n) input().split() ().split () input split x = [input().split() for i in range(n)] x [input().split() for i in range(n)] for i in range(n):
    x[i][1] = int(x[i][1])
    x[i].append(i+1) i range(n) range n x[i][1] = int(x[i][1]) x[i][1] [i] x i 1 int(x[i][1]) int x[i][1] [i] x i 1 x[i].append(i+1) [i].append [i] x i append i+1 i 1 x.sort(key= lambda a: a[1]) x.sort x sort key= lambda a: a[1] key lambda a: a[1] a[1] a 1 a x.reverse() x.reverse x reverse x.sort(key= lambda b: b[0]) x.sort x sort key= lambda b: b[0] key lambda b: b[0] b[0] b 0 b for i in range(n):
    print(x[i][2]) i range(n) range n print(x[i][2]) print x[i][2] [i] x i 2 n = int(input()) int(input()) n x = [input().split() for i in range(n)] [input().split() for i in range(n)] x
n = int(input())
x = [input().split() for i in range(n)]
for i in range(n):
    x[i][1] = int(x[i][1])
    x[i].append(i+1)

x.sort(key= lambda a: a[1])
x.reverse()
x.sort(key= lambda b: b[0])

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