n=int(input())
rec=[]
for i in range(n):
    a,b=input().split()
    rec.append([a,int(b),i+1])
rec=sorted(rec, reverse=True, key=lambda x: x[1]) 
rec=sorted(rec, key=lambda x: x[0]) 
for i in rec:
    print(i[2]) n=int(input()) n int(input()) int input() input rec=[] rec [] for i in range(n):
    a,b=input().split()
    rec.append([a,int(b),i+1]) i range(n) range n a,b=input().split() a input().split() ().split () input split b rec.append([a,int(b),i+1]) rec.append rec append [a,int(b),i+1] a int(b) int b i+1 i 1 rec=sorted(rec, reverse=True, key=lambda x: x[1]) rec sorted(rec, reverse=True, key=lambda x: x[1]) sorted rec reverse=True reverse True key=lambda x: x[1] key lambda x: x[1] x[1] x 1 x rec=sorted(rec, key=lambda x: x[0]) rec sorted(rec, key=lambda x: x[0]) sorted rec key=lambda x: x[0] key lambda x: x[0] x[0] x 0 x for i in rec:
    print(i[2]) i rec print(i[2]) print i[2] i 2 rec=[] [] rec b=input().split() input().split() b a,b=input().split() input().split() a rec=sorted(rec, key=lambda x: x[0]) sorted(rec, key=lambda x: x[0]) rec n=int(input()) int(input()) n rec=sorted(rec, reverse=True, key=lambda x: x[1]) sorted(rec, reverse=True, key=lambda x: x[1]) rec
n=int(input())
rec=[]
for i in range(n):
    a,b=input().split()
    rec.append([a,int(b),i+1])
rec=sorted(rec, reverse=True, key=lambda x: x[1]) 
rec=sorted(rec, key=lambda x: x[0]) 
for i in rec:
    print(i[2])