    n=int(input())
    q=[input().split()+[i]for i in range(n)]
        for i in range(n):
            q[i][1]=int(q[i][1])
          
        p =  sorted(q,key=lambda x:x[1],reverse=True))
    for s,t,r in p:
      print(r+1)