n = int(input())

sp = []

for i in range(n):
    si, pi = list(input().split())
    sp.append([si, -int(pi), i+1])

sp.sort()

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

sp = []

for i in range(n):
    si, pi = list(input().split())
    sp.append([si, -int(pi), i+1])

sp.sort()

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