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

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

for i in range(N):
    print(l[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 i+1 i 1 l = sorted(l,key = lambda x:x[1],reverse=True) l sorted(l,key = lambda x:x[1],reverse=True) sorted l key = lambda x:x[1] key lambda x:x[1] x[1] x 1 x reverse=True reverse True l = sorted(l,key = lambda x:x[0]) l sorted(l,key = lambda x:x[0]) sorted l key = lambda x:x[0] key lambda x:x[0] x[0] x 0 x for i in range(N):
    print(l[i][2]) i range(N) range N print(l[i][2]) print l[i][2] [i] l i 2 s,p = input().split() input().split() s l = [] [] l l = sorted(l,key = lambda x:x[1],reverse=True) sorted(l,key = lambda x:x[1],reverse=True) l p = input().split() input().split() p l = sorted(l,key = lambda x:x[0]) sorted(l,key = lambda x:x[0]) l N = int(input()) int(input()) N
N = int(input())
l = []
for i in range(N):
    s,p = input().split()
    l.append([s,int(p),i+1])

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

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