N = int(input())
Nlist = [[] for _ in range(N)]
for i in range(N):
    C, P = input().split()
    P = int(P)
    Nlist[i].append(i+1)
    Nlist[i].append(C)
    Nlist[i].append(P)

Nlist.sort(key=lambda x: x[1])
Nlist.sort(key=lambda x: x[2],reverse=True)
Nlist.sort(key=lambda x: x[1])
for i in range(N):
    print(Nlist[i][0]) N = int(input()) N int(input()) int input() input [] for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) [] Nlist = [[] for _ in range(N)] Nlist [[] for _ in range(N)] for i in range(N):
    C, P = input().split()
    P = int(P)
    Nlist[i].append(i+1)
    Nlist[i].append(C)
    Nlist[i].append(P) i range(N) range N C, P = input().split() C input().split() ().split () input split P P = int(P) P int(P) int P Nlist[i].append(i+1) [i].append [i] Nlist i append i+1 i 1 Nlist[i].append(C) [i].append [i] Nlist i append C Nlist[i].append(P) [i].append [i] Nlist i append P Nlist.sort(key=lambda x: x[1]) Nlist.sort Nlist sort key=lambda x: x[1] key lambda x: x[1] x[1] x 1 x Nlist.sort(key=lambda x: x[2],reverse=True) Nlist.sort Nlist sort key=lambda x: x[2] key lambda x: x[2] x[2] x 2 x reverse=True reverse True Nlist.sort(key=lambda x: x[1]) Nlist.sort Nlist sort key=lambda x: x[1] key lambda x: x[1] x[1] x 1 x for i in range(N):
    print(Nlist[i][0]) i range(N) range N print(Nlist[i][0]) print Nlist[i][0] [i] Nlist i 0 P = int(P) int(P) P Nlist = [[] for _ in range(N)] [[] for _ in range(N)] Nlist N = int(input()) int(input()) N C, P = input().split() input().split() C P = input().split() input().split() P
N = int(input())
Nlist = [[] for _ in range(N)]
for i in range(N):
    C, P = input().split()
    P = int(P)
    Nlist[i].append(i+1)
    Nlist[i].append(C)
    Nlist[i].append(P)

Nlist.sort(key=lambda x: x[1])
Nlist.sort(key=lambda x: x[2],reverse=True)
Nlist.sort(key=lambda x: x[1])
for i in range(N):
    print(Nlist[i][0])
