n = int(input())

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

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

for i in range(n):
    print(sp[i][2]) n = int(input()) n int(input()) int input() input sp = [] sp [] for i in range(1,n+1):
    s,p = input().split()
    sp.append([s,int(p),i]) i range(1,n+1) range 1 n+1 n 1 s,p = input().split() s input().split() ().split () input split p sp.append([s,int(p),i]) sp.append sp append [s,int(p),i] s int(p) int p i 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 range(n):
    print(sp[i][2]) i range(n) range n print(sp[i][2]) print sp[i][2] [i] sp i 2 n = int(input()) int(input()) n s,p = input().split() input().split() s p = input().split() input().split() p sp = [] [] sp
n = int(input())

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

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

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