n = int(input())

l = []
for i in range(n):
    x,y = input().split()
    y = int(y)
    l.append([x,y,i])
l.sort(key=lambda x:x[1],reverse=True)
l.sort(key=lambda x:x[0])

for s in l:
    print(s[2]+1) n = int(input()) n int(input()) int input() input l = [] l [] for i in range(n):
    x,y = input().split()
    y = int(y)
    l.append([x,y,i]) i range(n) range n x,y = input().split() x input().split() ().split () input split y y = int(y) y int(y) int y l.append([x,y,i]) l.append l append [x,y,i] x y i l.sort(key=lambda x:x[1],reverse=True) l.sort l sort key=lambda x:x[1] key lambda x:x[1] x[1] x 1 x reverse=True reverse True l.sort(key=lambda x:x[0]) l.sort l sort key=lambda x:x[0] key lambda x:x[0] x[0] x 0 x for s in l:
    print(s[2]+1) s l print(s[2]+1) print s[2]+1 s[2] s 2 1 y = input().split() input().split() y x,y = input().split() input().split() x n = int(input()) int(input()) n l = [] [] l y = int(y) int(y) y
n = int(input())

l = []
for i in range(n):
    x,y = input().split()
    y = int(y)
    l.append([x,y,i])
l.sort(key=lambda x:x[1],reverse=True)
l.sort(key=lambda x:x[0])

for s in l:
    print(s[2]+1)