n=int(input())
ans=[]
for i in range(n):
    a,b=map(str, input().split())
    ans.append([a,int(b)*-1,i+1])

import operator
ans.sort(key=operator.itemgetter(0,1))

for i in range(n):
    print(ans[i][2]) n=int(input()) n int(input()) int input() input ans=[] ans [] for i in range(n):
    a,b=map(str, input().split())
    ans.append([a,int(b)*-1,i+1]) i range(n) range n a,b=map(str, input().split()) a map(str, input().split()) map str input().split() ().split () input split b ans.append([a,int(b)*-1,i+1]) ans.append ans append [a,int(b)*-1,i+1] a int(b)*-1 int(b) int b -1 i+1 i 1 import operator operator ans.sort(key=operator.itemgetter(0,1)) ans.sort ans sort key=operator.itemgetter(0,1) key operator.itemgetter(0,1) operator.itemgetter operator itemgetter 0 1 for i in range(n):
    print(ans[i][2]) i range(n) range n print(ans[i][2]) print ans[i][2] [i] ans i 2 n=int(input()) int(input()) n b=map(str, input().split()) map(str, input().split()) b ans=[] [] ans a,b=map(str, input().split()) map(str, input().split()) a
n=int(input())
ans=[]
for i in range(n):
    a,b=map(str, input().split())
    ans.append([a,int(b)*-1,i+1])

import operator
ans.sort(key=operator.itemgetter(0,1))

for i in range(n):
    print(ans[i][2])