n = int(input())
r = []
for i in range(n):
    a = list(input().split())
    a[1] = int(a[1])
    a.append(i + 1)
    r.append(a)
r.sort(key = lambda x: x[1], reverse = True)
r.sort(key = lambda x: x[0])
for i in r:
    print(i[2]) n = int(input()) n int(input()) int input() input r = [] r [] for i in range(n):
    a = list(input().split())
    a[1] = int(a[1])
    a.append(i + 1)
    r.append(a) i range(n) range n a = list(input().split()) a list(input().split()) list input().split() ().split () input split a[1] = int(a[1]) a[1] a 1 int(a[1]) int a[1] a 1 a.append(i + 1) a.append a append i + 1 i 1 r.append(a) r.append r append a r.sort(key = lambda x: x[1], reverse = True) r.sort r sort key = lambda x: x[1] key lambda x: x[1] x[1] x 1 x reverse = True reverse True r.sort(key = lambda x: x[0]) r.sort r sort key = lambda x: x[0] key lambda x: x[0] x[0] x 0 x for i in r:
    print(i[2]) i r print(i[2]) print i[2] i 2 n = int(input()) int(input()) n r = [] [] r a = list(input().split()) list(input().split()) a
n = int(input())
r = []
for i in range(n):
    a = list(input().split())
    a[1] = int(a[1])
    a.append(i + 1)
    r.append(a)
r.sort(key = lambda x: x[1], reverse = True)
r.sort(key = lambda x: x[0])
for i in r:
    print(i[2])