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

anspoint=sorted(ans,key=lambda x:x[1], reverse=True)
anscity=sorted(anspoint,key=lambda x:x[0])

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

anspoint=sorted(ans,key=lambda x:x[1], reverse=True)
anscity=sorted(anspoint,key=lambda x:x[0])

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