n = int(input())
tbl = []

for i in range(n):
    l = list(map(str,input().split()))
    l[1] = int(l[1])
    l2 = [l[1], l[0], i + 1]
    tbl.append(l2)

tbl.sort(key = lambda x:(x[1], -x[0]))
for i in range(n):
    print(tbl[i][2]) n = int(input()) n int(input()) int input() input tbl = [] tbl [] for i in range(n):
    l = list(map(str,input().split()))
    l[1] = int(l[1])
    l2 = [l[1], l[0], i + 1]
    tbl.append(l2) i range(n) range n l = list(map(str,input().split())) l list(map(str,input().split())) list map(str,input().split()) map str input().split() ().split () input split l[1] = int(l[1]) l[1] l 1 int(l[1]) int l[1] l 1 l2 = [l[1], l[0], i + 1] l2 [l[1], l[0], i + 1] l[1] l 1 l[0] l 0 i + 1 i 1 tbl.append(l2) tbl.append tbl append l2 tbl.sort(key = lambda x:(x[1], -x[0])) tbl.sort tbl sort key = lambda x:(x[1], -x[0]) key lambda x:(x[1], -x[0]) (x[1], -x[0]) x[1] x 1 -x[0] x[0] x 0 x for i in range(n):
    print(tbl[i][2]) i range(n) range n print(tbl[i][2]) print tbl[i][2] [i] tbl i 2 l2 = [l[1], l[0], i + 1] [l[1], l[0], i + 1] l2 tbl = [] [] tbl n = int(input()) int(input()) n l = list(map(str,input().split())) list(map(str,input().split())) l
n = int(input())
tbl = []

for i in range(n):
    l = list(map(str,input().split()))
    l[1] = int(l[1])
    l2 = [l[1], l[0], i + 1]
    tbl.append(l2)

tbl.sort(key = lambda x:(x[1], -x[0]))
for i in range(n):
    print(tbl[i][2])
