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