N = int(input())

D = {}
q = set()
for i in range(N):
    s,p = input().split()
    if s in q:
        D[s].append([int(p),i])
    else:
        D[s] = [[int(p),i]]
        q.add(s)

ans = []
for i in sorted(list(q)):
    D[i].sort(reverse=True)
    for j in D[i]:
        ans.append(j[1])

[print(i+1) for i in ans] N = int(input()) N int(input()) int input() input D = {} D {} q = set() q set() set for i in range(N):
    s,p = input().split()
    if s in q:
        D[s].append([int(p),i])
    else:
        D[s] = [[int(p),i]]
        q.add(s) i range(N) range N s,p = input().split() s input().split() ().split () input split p if s in q:
        D[s].append([int(p),i])
    else:
        D[s] = [[int(p),i]]
        q.add(s) s in q s q D[s].append([int(p),i]) [s].append [s] D s append [int(p),i] int(p) int p i D[s] = [[int(p),i]] D[s] D s [[int(p),i]] [int(p),i] int(p) int p i q.add(s) q.add q add s ans = [] ans [] for i in sorted(list(q)):
    D[i].sort(reverse=True)
    for j in D[i]:
        ans.append(j[1]) i sorted(list(q)) sorted list(q) list q D[i].sort(reverse=True) [i].sort [i] D i sort reverse=True reverse True for j in D[i]:
        ans.append(j[1]) j D[i] D i ans.append(j[1]) ans.append ans append j[1] j 1 print(i+1) for i in ans for i in ans i ans for i in ans print(i+1) print i+1 i 1 [print(i+1) for i in ans] p = input().split() input().split() p N = int(input()) int(input()) N D = {} {} D s,p = input().split() input().split() s ans = [] [] ans q = set() set() q
N = int(input())

D = {}
q = set()
for i in range(N):
    s,p = input().split()
    if s in q:
        D[s].append([int(p),i])
    else:
        D[s] = [[int(p),i]]
        q.add(s)

ans = []
for i in sorted(list(q)):
    D[i].sort(reverse=True)
    for j in D[i]:
        ans.append(j[1])

[print(i+1) for i in ans]
