N = int(input())
S = []
P = []
for i in range(N):
    s,p = input().split()
    S.append(s)
    P.append(int(p))
Sset = sorted(list(set(S)))

dict1 = {}
for i in range(N):
    dict1[P[i]] = S[i]

for k in Sset:
    U = [i for i, j in dict1.items() if j == k]
    V = sorted(U,reverse=True)
    for l in V:
        print(P.index(l) + 1) N = int(input()) N int(input()) int input() input S = [] S [] P = [] P [] for i in range(N):
    s,p = input().split()
    S.append(s)
    P.append(int(p)) i range(N) range N s,p = input().split() s input().split() ().split () input split p S.append(s) S.append S append s P.append(int(p)) P.append P append int(p) int p Sset = sorted(list(set(S))) Sset sorted(list(set(S))) sorted list(set(S)) list set(S) set S dict1 = {} dict1 {} for i in range(N):
    dict1[P[i]] = S[i] i range(N) range N dict1[P[i]] = S[i] dict1[P[i]] dict1 P[i] P i S[i] S i for k in Sset:
    U = [i for i, j in dict1.items() if j == k]
    V = sorted(U,reverse=True)
    for l in V:
        print(P.index(l) + 1) k Sset i for i, j in dict1.items() if j == k for i, j in dict1.items() if j == k i j dict1.items() dict1.items dict1 items j == k j k if j == k i U = [i for i, j in dict1.items() if j == k] U [i for i, j in dict1.items() if j == k] V = sorted(U,reverse=True) V sorted(U,reverse=True) sorted U reverse=True reverse True for l in V:
        print(P.index(l) + 1) l V print(P.index(l) + 1) print P.index(l) + 1 P.index(l) P.index P index l 1 dict1 = {} {} dict1 p = input().split() input().split() p s,p = input().split() input().split() s U = [i for i, j in dict1.items() if j == k] [i for i, j in dict1.items() if j == k] U N = int(input()) int(input()) N Sset = sorted(list(set(S))) sorted(list(set(S))) Sset S = [] [] S P = [] [] P V = sorted(U,reverse=True) sorted(U,reverse=True) V
N = int(input())
S = []
P = []
for i in range(N):
    s,p = input().split()
    S.append(s)
    P.append(int(p))
Sset = sorted(list(set(S)))

dict1 = {}
for i in range(N):
    dict1[P[i]] = S[i]

for k in Sset:
    U = [i for i, j in dict1.items() if j == k]
    V = sorted(U,reverse=True)
    for l in V:
        print(P.index(l) + 1)