n = int(input())

citydic = {}
for i in range(n):
    s,p = map(str,input().split())
    if s not in citydic:
        citydic[s] = [[int(p),i+1]]
    else:
        citydic[s].append([int(p),i+1])
        citydic[s].sort(reverse=True)

citydic = sorted(citydic.items())

for k in citydic:
    for v in k[1:]:
        for n in v:
            print(n[1]) n = int(input()) n int(input()) int input() input citydic = {} citydic {} for i in range(n):
    s,p = map(str,input().split())
    if s not in citydic:
        citydic[s] = [[int(p),i+1]]
    else:
        citydic[s].append([int(p),i+1])
        citydic[s].sort(reverse=True) i range(n) range n s,p = map(str,input().split()) s map(str,input().split()) map str input().split() ().split () input split p if s not in citydic:
        citydic[s] = [[int(p),i+1]]
    else:
        citydic[s].append([int(p),i+1])
        citydic[s].sort(reverse=True) s not in citydic s citydic citydic[s] = [[int(p),i+1]] citydic[s] citydic s [[int(p),i+1]] [int(p),i+1] int(p) int p i+1 i 1 citydic[s].append([int(p),i+1]) [s].append [s] citydic s append [int(p),i+1] int(p) int p i+1 i 1 citydic[s].sort(reverse=True) [s].sort [s] citydic s sort reverse=True reverse True citydic = sorted(citydic.items()) citydic sorted(citydic.items()) sorted citydic.items() citydic.items citydic items for k in citydic:
    for v in k[1:]:
        for n in v:
            print(n[1]) k citydic for v in k[1:]:
        for n in v:
            print(n[1]) v k[1:] k 1: 1 for n in v:
            print(n[1]) n v print(n[1]) print n[1] n 1 citydic = sorted(citydic.items()) sorted(citydic.items()) citydic p = map(str,input().split()) map(str,input().split()) p n = int(input()) int(input()) n citydic = {} {} citydic s,p = map(str,input().split()) map(str,input().split()) s
n = int(input())

citydic = {}
for i in range(n):
    s,p = map(str,input().split())
    if s not in citydic:
        citydic[s] = [[int(p),i+1]]
    else:
        citydic[s].append([int(p),i+1])
        citydic[s].sort(reverse=True)

citydic = sorted(citydic.items())

for k in citydic:
    for v in k[1:]:
        for n in v:
            print(n[1])