#B - Guidebook (別解)
N = int(input())

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


ans = sorted(iSP, key = lambda x:x[2], reverse = True)

ans = sorted(ans, key = lambda x:x[1])

for j,k,l in ans:
    print(j) N = int(input()) N int(input()) int input() input iSP = [] iSP [] for i in range(N):
    s,p = input().split()
    iSP.append([i+1,s,int(p)]) i range(N) range N s,p = input().split() s input().split() ().split () input split p iSP.append([i+1,s,int(p)]) iSP.append iSP append [i+1,s,int(p)] i+1 i 1 s int(p) int p ans = sorted(iSP, key = lambda x:x[2], reverse = True) ans sorted(iSP, key = lambda x:x[2], reverse = True) sorted iSP key = lambda x:x[2] key lambda x:x[2] x[2] x 2 x reverse = True reverse True ans = sorted(ans, key = lambda x:x[1]) ans sorted(ans, key = lambda x:x[1]) sorted ans key = lambda x:x[1] key lambda x:x[1] x[1] x 1 x for j,k,l in ans:
    print(j) j k l ans print(j) print j s,p = input().split() input().split() s ans = sorted(iSP, key = lambda x:x[2], reverse = True) sorted(iSP, key = lambda x:x[2], reverse = True) ans p = input().split() input().split() p ans = sorted(ans, key = lambda x:x[1]) sorted(ans, key = lambda x:x[1]) ans N = int(input()) int(input()) N iSP = [] [] iSP
#B - Guidebook (別解)
N = int(input())

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


ans = sorted(iSP, key = lambda x:x[2], reverse = True)

ans = sorted(ans, key = lambda x:x[1])

for j,k,l in ans:
    print(j)