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