n = int(input())

data = []
for i in range(n):
    s,p = input().split()
    p = int(p)
    data.append((s,-p,i))

sorted_data = sorted(data, key=lambda x:(x[0], x[1]), reverse=False)

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

data = []
for i in range(n):
    s,p = input().split()
    p = int(p)
    data.append((s,-p,i))

sorted_data = sorted(data, key=lambda x:(x[0], x[1]), reverse=False)

for i in range(n):
    print(sorted_data[i][2] + 1)