N = int(input())
Rest = dict()
Parg = [0]*(101)
for i in range(N):
    S, P = map(str,input().split())
    P = int(P)
    if S not in Rest:
        Rest[S] = [P]
    else:
        Rest[S] += [P]
    Parg[P] = i+1 
Restsort = sorted(Rest)
for cit in Restsort:
    box = Rest[cit]
    box.sort(reverse = True)
    for j in box:
        print(Parg[j]) N = int(input()) N int(input()) int input() input Rest = dict() Rest dict() dict Parg = [0]*(101) Parg [0]*(101) [0] 0 101 for i in range(N):
    S, P = map(str,input().split())
    P = int(P)
    if S not in Rest:
        Rest[S] = [P]
    else:
        Rest[S] += [P]
    Parg[P] = i+1  i range(N) range N S, P = map(str,input().split()) S map(str,input().split()) map str input().split() ().split () input split P P = int(P) P int(P) int P if S not in Rest:
        Rest[S] = [P]
    else:
        Rest[S] += [P]
     S not in Rest S Rest Rest[S] = [P] Rest[S] Rest S [P] P Rest[S] += [P] Rest[S] Rest S [P] P Parg[P] = i+1 Parg[P] Parg P i+1 i 1 Restsort = sorted(Rest) Restsort sorted(Rest) sorted Rest for cit in Restsort:
    box = Rest[cit]
    box.sort(reverse = True)
    for j in box:
        print(Parg[j]) cit Restsort box = Rest[cit] box Rest[cit] Rest cit box.sort(reverse = True) box.sort box sort reverse = True reverse True for j in box:
        print(Parg[j]) j box print(Parg[j]) print Parg[j] Parg j Restsort = sorted(Rest) sorted(Rest) Restsort N = int(input()) int(input()) N S, P = map(str,input().split()) map(str,input().split()) S P = map(str,input().split()) map(str,input().split()) P Parg = [0]*(101) [0]*(101) Parg box = Rest[cit] Rest[cit] box P = int(P) int(P) P Rest = dict() dict() Rest
N = int(input())
Rest = dict()
Parg = [0]*(101)
for i in range(N):
    S, P = map(str,input().split())
    P = int(P)
    if S not in Rest:
        Rest[S] = [P]
    else:
        Rest[S] += [P]
    Parg[P] = i+1 
Restsort = sorted(Rest)
for cit in Restsort:
    box = Rest[cit]
    box.sort(reverse = True)
    for j in box:
        print(Parg[j])