N = int(input())

SP =[]
for i in range(N):
    SP.append([i+1] + list(map(str,input().split())))
    SP[i][2] = int(SP[i][2])

SP = sorted(SP,key = lambda x: x[2], reverse=True)
SP = sorted(SP,key = lambda x: x[1])

for i in range(N):
    print(SP[i][0]) N = int(input()) N int(input()) int input() input SP =[] SP [] for i in range(N):
    SP.append([i+1] + list(map(str,input().split())))
    SP[i][2] = int(SP[i][2]) i range(N) range N SP.append([i+1] + list(map(str,input().split()))) SP.append SP append [i+1] + list(map(str,input().split())) [i+1] i+1 i 1 list(map(str,input().split())) list map(str,input().split()) map str input().split() ().split () input split SP[i][2] = int(SP[i][2]) SP[i][2] [i] SP i 2 int(SP[i][2]) int SP[i][2] [i] SP i 2 SP = sorted(SP,key = lambda x: x[2], reverse=True) SP sorted(SP,key = lambda x: x[2], reverse=True) sorted SP key = lambda x: x[2] key lambda x: x[2] x[2] x 2 x reverse=True reverse True SP = sorted(SP,key = lambda x: x[1]) SP sorted(SP,key = lambda x: x[1]) sorted SP key = lambda x: x[1] key lambda x: x[1] x[1] x 1 x for i in range(N):
    print(SP[i][0]) i range(N) range N print(SP[i][0]) print SP[i][0] [i] SP i 0 SP =[] [] SP SP = sorted(SP,key = lambda x: x[2], reverse=True) sorted(SP,key = lambda x: x[2], reverse=True) SP N = int(input()) int(input()) N SP = sorted(SP,key = lambda x: x[1]) sorted(SP,key = lambda x: x[1]) SP
N = int(input())

SP =[]
for i in range(N):
    SP.append([i+1] + list(map(str,input().split())))
    SP[i][2] = int(SP[i][2])

SP = sorted(SP,key = lambda x: x[2], reverse=True)
SP = sorted(SP,key = lambda x: x[1])

for i in range(N):
    print(SP[i][0])
