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