N = int(input())

R = []

for i in range(N):
    S,P = input().split()
    R.append([S, -int(P), i+1])

R.sort()

for r in R:
    print(r[2]) N = int(input()) N int(input()) int input() input R = [] R [] for i in range(N):
    S,P = input().split()
    R.append([S, -int(P), i+1]) i range(N) range N S,P = input().split() S input().split() ().split () input split P R.append([S, -int(P), i+1]) R.append R append [S, -int(P), i+1] S -int(P) int(P) int P i+1 i 1 R.sort() R.sort R sort for r in R:
    print(r[2]) r R print(r[2]) print r[2] r 2 P = input().split() input().split() P R = [] [] R N = int(input()) int(input()) N S,P = input().split() input().split() S
N = int(input())

R = []

for i in range(N):
    S,P = input().split()
    R.append([S, -int(P), i+1])

R.sort()

for r in R:
    print(r[2])