N = int(input())
l = []
for i in range(N):
    s,p = input().split(" ")
    l.append([s,-int(p),i+1])
l.sort()

for i in l:
    print(i[2]) N = int(input()) N int(input()) int input() input l = [] l [] for i in range(N):
    s,p = input().split(" ")
    l.append([s,-int(p),i+1]) i range(N) range N s,p = input().split(" ") s input().split(" ") ().split () input split " " p l.append([s,-int(p),i+1]) l.append l append [s,-int(p),i+1] s -int(p) int(p) int p i+1 i 1 l.sort() l.sort l sort for i in l:
    print(i[2]) i l print(i[2]) print i[2] i 2 l = [] [] l p = input().split(" ") input().split(" ") p N = int(input()) int(input()) N s,p = input().split(" ") input().split(" ") s
N = int(input())
l = []
for i in range(N):
    s,p = input().split(" ")
    l.append([s,-int(p),i+1])
l.sort()

for i in l:
    print(i[2])