N = int(input())
S = []
P = []

for i in range(N):
    s, p = input().split()
    S.append(s)
    P.append(int(p))

name = list(sorted(set(S)))

for i in range(len(name)):
    score = []
    number = []
    for j in range(N):
        if S[j] == name[i]:
            score.append(P[j])
            number.append(j+1)
    for k in range(S.count(name[i])):
        place = score.index(max(score))
        print(number[place])
        del number[place]
        del score[place] 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 name = list(sorted(set(S))) name list(sorted(set(S))) list sorted(set(S)) sorted set(S) set S for i in range(len(name)):
    score = []
    number = []
    for j in range(N):
        if S[j] == name[i]:
            score.append(P[j])
            number.append(j+1)
    for k in range(S.count(name[i])):
        place = score.index(max(score))
        print(number[place])
        del number[place]
        del score[place] i range(len(name)) range len(name) len name score = [] score [] number = [] number [] for j in range(N):
        if S[j] == name[i]:
            score.append(P[j])
            number.append(j+1)
     j range(N) range N if S[j] == name[i]:
            score.append(P[j])
            number.append(j+1)
     S[j] == name[i] S[j] S j name[i] name i score.append(P[j]) score.append score append P[j] P j number.append(j+1) number.append number append j+1 j 1 for k in range(S.count(name[i])):
        place = score.index(max(score))
        print(number[place])
        del number[place]
        del score[place] k range(S.count(name[i])) range S.count(name[i]) S.count S count name[i] name i place = score.index(max(score)) place score.index(max(score)) score.index score index max(score) max score print(number[place]) print number[place] number place del number[place] number[place] number place del score[place] score[place] score place P = [] [] P S = [] [] S place = score.index(max(score)) score.index(max(score)) place p = input().split() input().split() p name = list(sorted(set(S))) list(sorted(set(S))) name number = [] [] number s, p = input().split() input().split() s N = int(input()) int(input()) N score = [] [] score
N = int(input())
S = []
P = []

for i in range(N):
    s, p = input().split()
    S.append(s)
    P.append(int(p))

name = list(sorted(set(S)))

for i in range(len(name)):
    score = []
    number = []
    for j in range(N):
        if S[j] == name[i]:
            score.append(P[j])
            number.append(j+1)
    for k in range(S.count(name[i])):
        place = score.index(max(score))
        print(number[place])
        del number[place]
        del score[place]
