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

city = sorted(city.items())

for i in city:
    for j in i[1:]:
        for k in j:
            print(k[1]) N = int(input()) N int(input()) int input() input city = {} city {} for i in range(N):
    s,p = map(str,input().split())
    if s not in city:
        city[s] = [[int(p),i+1]]
    else:
        city[s].append([int(p),i+1])
        city[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 city:
        city[s] = [[int(p),i+1]]
    else:
        city[s].append([int(p),i+1])
        city[s].sort(reverse=True) s not in city s city city[s] = [[int(p),i+1]] city[s] city s [[int(p),i+1]] [int(p),i+1] int(p) int p i+1 i 1 city[s].append([int(p),i+1]) [s].append [s] city s append [int(p),i+1] int(p) int p i+1 i 1 city[s].sort(reverse=True) [s].sort [s] city s sort reverse=True reverse True city = sorted(city.items()) city sorted(city.items()) sorted city.items() city.items city items for i in city:
    for j in i[1:]:
        for k in j:
            print(k[1]) i city for j in i[1:]:
        for k in j:
            print(k[1]) j i[1:] i 1: 1 for k in j:
            print(k[1]) k j print(k[1]) print k[1] k 1 city = {} {} city p = map(str,input().split()) map(str,input().split()) p N = int(input()) int(input()) N city = sorted(city.items()) sorted(city.items()) city s,p = map(str,input().split()) map(str,input().split()) s
N = int(input())
city = {}
for i in range(N):
    s,p = map(str,input().split())
    if s not in city:
        city[s] = [[int(p),i+1]]
    else:
        city[s].append([int(p),i+1])
        city[s].sort(reverse=True)

city = sorted(city.items())

for i in city:
    for j in i[1:]:
        for k in j:
            print(k[1])