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