import sys
N = int(input())
test = lambda x: [ x[0],int(x[1]) ]
array = [ [test(input().split()),int(x+1)] for x in range(N) ]

if not ( 1 <= N <= 100 ): sys.exit()
for I in array:
    if not ( 1 <= len(I[0][0]) <= 10 ): sys.exit()
    if not I[0][0].islower(): sys.exit()
    if not ( 0 <= I[0][1] <= 100 ): sys.exit()
    if not isinstance(I[0][1],int): sys.exit()

array.sort(key=lambda x: x[0][1], reverse=True)
array.sort(key=lambda x: x[0][0])

for I in array:
    print(I[1]) import sys sys N = int(input()) N int(input()) int input() input test = lambda x: [ x[0],int(x[1]) ] test lambda x: [ x[0],int(x[1]) ] [ x[0],int(x[1]) ] x[0] x 0 int(x[1]) int x[1] x 1 x [test(input().split()),int(x+1)] for x in range(N) for x in range(N) x range(N) range N for x in range(N) [test(input().split()),int(x+1)] test(input().split()) test input().split() ().split () input split int(x+1) int x+1 x 1 array = [ [test(input().split()),int(x+1)] for x in range(N) ] array [ [test(input().split()),int(x+1)] for x in range(N) ] if not ( 1 <= N <= 100 ): sys.exit() not ( 1 <= N <= 100 ) 1 <= N <= 100 1 <= N 1 N 100 for I in array:
    if not ( 1 <= len(I[0][0]) <= 10 ): sys.exit()
    if not I[0][0].islower(): sys.exit()
    if not ( 0 <= I[0][1] <= 100 ): sys.exit()
    if not isinstance(I[0][1],int): sys.exit() I array if not ( 1 <= len(I[0][0]) <= 10 ): sys.exit()
     not ( 1 <= len(I[0][0]) <= 10 ) 1 <= len(I[0][0]) <= 10 1 <= len(I[0][0]) 1 len(I[0][0]) len I[0][0] [0] I 0 0 10 if not I[0][0].islower(): sys.exit()
     not I[0][0].islower() I[0][0].islower() [0].islower [0] [0] I 0 0 islower if not ( 0 <= I[0][1] <= 100 ): sys.exit()
     not ( 0 <= I[0][1] <= 100 ) 0 <= I[0][1] <= 100 0 <= I[0][1] 0 I[0][1] [0] I 0 1 100 if not isinstance(I[0][1],int): sys.ex not isinstance(I[0][1],int) isinstance(I[0][1],int) isinstance I[0][1] [0] I 0 1 int array.sort(key=lambda x: x[0][1], reverse=True) array.sort array sort key=lambda x: x[0][1] key lambda x: x[0][1] x[0][1] [0] x 0 1 x reverse=True reverse True array.sort(key=lambda x: x[0][0]) array.sort array sort key=lambda x: x[0][0] key lambda x: x[0][0] x[0][0] [0] x 0 0 x for I in array:
    print(I[1]) I array print(I[1]) print I[1] I 1 test = lambda x: [ x[0],int(x[1]) ] lambda x: [ x[0],int(x[1]) ] test N = int(input()) int(input()) N array = [ [test(input().split()),int(x+1)] for x in range(N) ] [ [test(input().split()),int(x+1)] for x in range(N) ] array
import sys
N = int(input())
test = lambda x: [ x[0],int(x[1]) ]
array = [ [test(input().split()),int(x+1)] for x in range(N) ]

if not ( 1 <= N <= 100 ): sys.exit()
for I in array:
    if not ( 1 <= len(I[0][0]) <= 10 ): sys.exit()
    if not I[0][0].islower(): sys.exit()
    if not ( 0 <= I[0][1] <= 100 ): sys.exit()
    if not isinstance(I[0][1],int): sys.exit()

array.sort(key=lambda x: x[0][1], reverse=True)
array.sort(key=lambda x: x[0][0])

for I in array:
    print(I[1])