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

data.sort(key = lambda x:x[1], reverse=True)
data.sort(key = lambda x:x[0])

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

data.sort(key = lambda x:x[1], reverse=True)
data.sort(key = lambda x:x[0])

for num in data:
    print(num[2])
