n = int(input())
sp = {i+1:input().split() for i in range(n)}

d = []
for i,s in sp.items():
    d.append((i,s[0],int(s[1])))
    
d = sorted(d,key=lambda x:x[2],reverse=True)
d = sorted(d,key=lambda x:x[1])
    
    
for i in d:
    print(i[0]) n = int(input()) n int(input()) int input() input i+1:input().split() for i in range(n) for i in range(n) i range(n) range n for i in range(n) i+1 i 1 input().split() ().split () input split sp = {i+1:input().split() for i in range(n)} sp {i+1:input().split() for i in range(n)} d = [] d [] for i,s in sp.items():
    d.append((i,s[0],int(s[1])))
     i s sp.items() sp.items sp items d.append((i,s[0],int(s[1]))) d.append d append (i,s[0],int(s[1])) i s[0] s 0 int(s[1]) int s[1] s 1 d = sorted(d,key=lambda x:x[2],reverse=True) d sorted(d,key=lambda x:x[2],reverse=True) sorted d key=lambda x:x[2] key lambda x:x[2] x[2] x 2 x reverse=True reverse True d = sorted(d,key=lambda x:x[1]) d sorted(d,key=lambda x:x[1]) sorted d key=lambda x:x[1] key lambda x:x[1] x[1] x 1 x for i in d:
    print(i[0]) i d print(i[0]) print i[0] i 0 d = [] [] d d = sorted(d,key=lambda x:x[2],reverse=True) sorted(d,key=lambda x:x[2],reverse=True) d n = int(input()) int(input()) n sp = {i+1:input().split() for i in range(n)} {i+1:input().split() for i in range(n)} sp d = sorted(d,key=lambda x:x[1]) sorted(d,key=lambda x:x[1]) d
n = int(input())
sp = {i+1:input().split() for i in range(n)}

d = []
for i,s in sp.items():
    d.append((i,s[0],int(s[1])))
    
d = sorted(d,key=lambda x:x[2],reverse=True)
d = sorted(d,key=lambda x:x[1])
    
    
for i in d:
    print(i[0])
