n  = int(input())

city_points = []
for i in range(n):
    s, p = input().split()
    city_points.append([s, -int(p), i + 1])

city_points.sort()

for i in city_points:
    print(i[-1]) n  = int(input()) n int(input()) int input() input city_points = [] city_points [] for i in range(n):
    s, p = input().split()
    city_points.append([s, -int(p), i + 1]) i range(n) range n s, p = input().split() s input().split() ().split () input split p city_points.append([s, -int(p), i + 1]) city_points.append city_points append [s, -int(p), i + 1] s -int(p) int(p) int p i + 1 i 1 city_points.sort() city_points.sort city_points sort for i in city_points:
    print(i[-1]) i city_points print(i[-1]) print i[-1] i -1 p = input().split() input().split() p n  = int(input()) int(input()) n s, p = input().split() input().split() s city_points = [] [] city_points
n  = int(input())

city_points = []
for i in range(n):
    s, p = input().split()
    city_points.append([s, -int(p), i + 1])

city_points.sort()

for i in city_points:
    print(i[-1])