N = int(input())

l = []

for i in range(N):
    s, p = input().split()
    
    l.append([i + 1, s, int(p)])
    
l = sorted(l, key=lambda x: x[2], reverse=True)
l = sorted(l, key=lambda x: x[1])

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

l = []

for i in range(N):
    s, p = input().split()
    
    l.append([i + 1, s, int(p)])
    
l = sorted(l, key=lambda x: x[2], reverse=True)
l = sorted(l, key=lambda x: x[1])

for x in l:
    print(x[0])