n = int(input())
a = [[input().split(),i + 1] for i in range(n)]
a = sorted(a,key = lambda x:(x[0][0],-int(x[0][1])))

for j in range(n):
    print(a[j][1]) n = int(input()) n int(input()) int input() input [input().split(),i + 1] for i in range(n) for i in range(n) i range(n) range n for i in range(n) [input().split(),i + 1] input().split() ().split () input split i + 1 i 1 a = [[input().split(),i + 1] for i in range(n)] a [[input().split(),i + 1] for i in range(n)] a = sorted(a,key = lambda x:(x[0][0],-int(x[0][1]))) a sorted(a,key = lambda x:(x[0][0],-int(x[0][1]))) sorted a key = lambda x:(x[0][0],-int(x[0][1])) key lambda x:(x[0][0],-int(x[0][1])) (x[0][0],-int(x[0][1])) x[0][0] [0] x 0 0 -int(x[0][1]) int(x[0][1]) int x[0][1] [0] x 0 1 x for j in range(n):
    print(a[j][1]) j range(n) range n print(a[j][1]) print a[j][1] [j] a j 1 a = sorted(a,key = lambda x:(x[0][0],-int(x[0][1]))) sorted(a,key = lambda x:(x[0][0],-int(x[0][1]))) a a = [[input().split(),i + 1] for i in range(n)] [[input().split(),i + 1] for i in range(n)] a n = int(input()) int(input()) n
n = int(input())
a = [[input().split(),i + 1] for i in range(n)]
a = sorted(a,key = lambda x:(x[0][0],-int(x[0][1])))

for j in range(n):
    print(a[j][1])