(N,),*sp = [s.split() for s in open(0)]

sp = [(s,-int(p),i+1) for i,(s,p) in enumerate(sp)]

for _,_,i in sorted(sp):
    print(i) s.split() for s in open(0) for s in open(0) s open(0) open 0 for s in open(0) s.split() s.split s split (N,),*sp = [s.split() for s in open(0)] N [s.split() for s in open(0)] *sp sp (s,-int(p),i+1) for i,(s,p) in enumerate(sp) for i,(s,p) in enumerate(sp) i (s,p) s p enumerate(sp) enumerate sp for i,(s,p) in enumerate(sp) (s,-int(p),i+1) s -int(p) int(p) int p i+1 i 1 sp = [(s,-int(p),i+1) for i,(s,p) in enumerate(sp)] sp [(s,-int(p),i+1) for i,(s,p) in enumerate(sp)] for _,_,i in sorted(sp):
    print(i) _ _ i sorted(sp) sorted sp print(i) print i N,),*sp = [s.split() for s in open(0)] [s.split() for s in open(0)] N sp = [(s,-int(p),i+1) for i,(s,p) in enumerate(sp)] [(s,-int(p),i+1) for i,(s,p) in enumerate(sp)] sp
(N,),*sp = [s.split() for s in open(0)]

sp = [(s,-int(p),i+1) for i,(s,p) in enumerate(sp)]

for _,_,i in sorted(sp):
    print(i)