n = int(input())

sp = []
for i in range(n):
    _s, _p = input().split()
    sp.append((_s, int(_p), i+1))

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

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

sp = []
for i in range(n):
    _s, _p = input().split()
    sp.append((_s, int(_p), i+1))

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

for i in sp:
    print(i[2])