n = int(input())
ans = [0]*n
for i in range(n):
    a, b = map(str, input().split())
    b = int(b)
    ans[i] = [i+1, a, b]
ans.sort(key=lambda x: (x[1], -x[2]))
for j in ans:
    print(j[0]) n = int(input()) n int(input()) int input() input ans = [0]*n ans [0]*n [0] 0 n for i in range(n):
    a, b = map(str, input().split())
    b = int(b)
    ans[i] = [i+1, a, b] i range(n) range n a, b = map(str, input().split()) a map(str, input().split()) map str input().split() ().split () input split b b = int(b) b int(b) int b ans[i] = [i+1, a, b] ans[i] ans i [i+1, a, b] i+1 i 1 a b ans.sort(key=lambda x: (x[1], -x[2])) ans.sort ans sort key=lambda x: (x[1], -x[2]) key lambda x: (x[1], -x[2]) (x[1], -x[2]) x[1] x 1 -x[2] x[2] x 2 x for j in ans:
    print(j[0]) j ans print(j[0]) print j[0] j 0 ans = [0]*n [0]*n ans b = int(b) int(b) b n = int(input()) int(input()) n b = map(str, input().split()) map(str, input().split()) b a, b = map(str, input().split()) map(str, input().split()) a
n = int(input())
ans = [0]*n
for i in range(n):
    a, b = map(str, input().split())
    b = int(b)
    ans[i] = [i+1, a, b]
ans.sort(key=lambda x: (x[1], -x[2]))
for j in ans:
    print(j[0])