n=int(input())
a=[]
for i in range(1,n+1):
    s,t=input().split()
    t=int(t)    
    t=-t
    a.append((s,t,i))
a.sort()
for i in range(n):
    print(a[i][2]) n=int(input()) n int(input()) int input() input a=[] a [] for i in range(1,n+1):
    s,t=input().split()
    t=int(t)    
    t=-t
    a.append((s,t,i)) i range(1,n+1) range 1 n+1 n 1 s,t=input().split() s input().split() ().split () input split t t=int(t) t int(t) int t t=-t t -t t a.append((s,t,i)) a.append a append (s,t,i) s t i a.sort() a.sort a sort for i in range(n):
    print(a[i][2]) i range(n) range n print(a[i][2]) print a[i][2] [i] a i 2 t=input().split() input().split() t s,t=input().split() input().split() s t=int(t) int(t) t n=int(input()) int(input()) n t=-t -t t a=[] [] a
n=int(input())
a=[]
for i in range(1,n+1):
    s,t=input().split()
    t=int(t)    
    t=-t
    a.append((s,t,i))
a.sort()
for i in range(n):
    print(a[i][2])