n = int(input())
city_to_points = dict()

for i in range(n):
    s, p = input().split()
    p = int(p)
    if s not in city_to_points:
        city_to_points[s] = [[p, i + 1]]
    else:
        city_to_points[s].append([p, i + 1])

kyes = list(city_to_points.keys())
kyes.sort()

for i in kyes:
    restrans = city_to_points[i]
    restrans.sort(reverse=True)
    for j in restrans:
        print(j[1]) n = int(input()) n int(input()) int input() input city_to_points = dict() city_to_points dict() dict for i in range(n):
    s, p = input().split()
    p = int(p)
    if s not in city_to_points:
        city_to_points[s] = [[p, i + 1]]
    else:
        city_to_points[s].append([p, i + 1]) i range(n) range n s, p = input().split() s input().split() ().split () input split p p = int(p) p int(p) int p if s not in city_to_points:
        city_to_points[s] = [[p, i + 1]]
    else:
        city_to_points[s].append([p, i + 1]) s not in city_to_points s city_to_points city_to_points[s] = [[p, i + 1]] city_to_points[s] city_to_points s [[p, i + 1]] [p, i + 1] p i + 1 i 1 city_to_points[s].append([p, i + 1]) [s].append [s] city_to_points s append [p, i + 1] p i + 1 i 1 kyes = list(city_to_points.keys()) kyes list(city_to_points.keys()) list city_to_points.keys() city_to_points.keys city_to_points keys kyes.sort() kyes.sort kyes sort for i in kyes:
    restrans = city_to_points[i]
    restrans.sort(reverse=True)
    for j in restrans:
        print(j[1]) i kyes restrans = city_to_points[i] restrans city_to_points[i] city_to_points i restrans.sort(reverse=True) restrans.sort restrans sort reverse=True reverse True for j in restrans:
        print(j[1]) j restrans print(j[1]) print j[1] j 1 s, p = input().split() input().split() s p = input().split() input().split() p n = int(input()) int(input()) n p = int(p) int(p) p city_to_points = dict() dict() city_to_points kyes = list(city_to_points.keys()) list(city_to_points.keys()) kyes restrans = city_to_points[i] city_to_points[i] restrans
n = int(input())
city_to_points = dict()

for i in range(n):
    s, p = input().split()
    p = int(p)
    if s not in city_to_points:
        city_to_points[s] = [[p, i + 1]]
    else:
        city_to_points[s].append([p, i + 1])

kyes = list(city_to_points.keys())
kyes.sort()

for i in kyes:
    restrans = city_to_points[i]
    restrans.sort(reverse=True)
    for j in restrans:
        print(j[1])