N = int(input())
dic = {}
for i in range(N):
    S,P = map(str,input().split())
    if S not in dic:
        dic[S] = [(-1*int(P), i+1)]
    else:
        dic[S].append((-1*int(P), i+1))
ls = list(dic.items())
ls.sort()
for city in ls:
    points = sorted(city[1])
    for point in points:
        print(point[1]) N = int(input()) N int(input()) int input() input dic = {} dic {} for i in range(N):
    S,P = map(str,input().split())
    if S not in dic:
        dic[S] = [(-1*int(P), i+1)]
    else:
        dic[S].append((-1*int(P), i+1)) 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 dic:
        dic[S] = [(-1*int(P), i+1)]
    else:
        dic[S].append((-1*int(P), i+1)) S not in dic S dic dic[S] = [(-1*int(P), i+1)] dic[S] dic S [(-1*int(P), i+1)] (-1*int(P), i+1) -1*int(P) -1 int(P) int P i+1 i 1 dic[S].append((-1*int(P), i+1)) [S].append [S] dic S append (-1*int(P), i+1) -1*int(P) -1 int(P) int P i+1 i 1 ls = list(dic.items()) ls list(dic.items()) list dic.items() dic.items dic items ls.sort() ls.sort ls sort for city in ls:
    points = sorted(city[1])
    for point in points:
        print(point[1]) city ls points = sorted(city[1]) points sorted(city[1]) sorted city[1] city 1 for point in points:
        print(point[1]) point points print(point[1]) print point[1] point 1 ls = list(dic.items()) list(dic.items()) ls dic = {} {} dic P = map(str,input().split()) map(str,input().split()) P S,P = map(str,input().split()) map(str,input().split()) S N = int(input()) int(input()) N points = sorted(city[1]) sorted(city[1]) points
N = int(input())
dic = {}
for i in range(N):
    S,P = map(str,input().split())
    if S not in dic:
        dic[S] = [(-1*int(P), i+1)]
    else:
        dic[S].append((-1*int(P), i+1))
ls = list(dic.items())
ls.sort()
for city in ls:
    points = sorted(city[1])
    for point in points:
        print(point[1])