N=int(input())
SP=[]
for i in range(N):
    SP.append(list(input().split()))
for i in range(N):
    SP[i].append(i+1)
A=[]
B=[]
C=[]
for i in range(N):
    A.append(SP[i][0])
A.sort()
B.append(A[0])
for i in range(0,N-1):
    if A[i]!=A[i+1]:
        B.append(A[i+1])
for i in range(len(B)):
    C.append([])
for i in range(len(B)):
    for j in range(len(SP)):
        if B[i]==SP[j][0]:
            C[i].append([int(SP[j][1]),SP[j][2]])
for i in range(len(C)):
    for j in range(1,len(C[i])):
        d=C[i][j]
        k=j-1
        while (k>=0 and C[i][k]<d):
            C[i][k+1]=C[i][k]
            k-=1
        C[i][k+1]=d
for i in range(len(C)):
    for j in range(len(C[i])):
        print(C[i][j][1]) N=int(input()) N int(input()) int input() input SP=[] SP [] for i in range(N):
    SP.append(list(input().split())) i range(N) range N SP.append(list(input().split())) SP.append SP append list(input().split()) list input().split() ().split () input split for i in range(N):
    SP[i].append(i+1) i range(N) range N SP[i].append(i+1) [i].append [i] SP i append i+1 i 1 A=[] A [] B=[] B [] C=[] C [] for i in range(N):
    A.append(SP[i][0]) i range(N) range N A.append(SP[i][0]) A.append A append SP[i][0] [i] SP i 0 A.sort() A.sort A sort B.append(A[0]) B.append B append A[0] A 0 for i in range(0,N-1):
    if A[i]!=A[i+1]:
        B.append(A[i+1]) i range(0,N-1) range 0 N-1 N 1 if A[i]!=A[i+1]:
        B.append(A[i+1]) A[i]!=A[i+1] A[i] A i A[i+1] A i+1 i 1 B.append(A[i+1]) B.append B append A[i+1] A i+1 i 1 for i in range(len(B)):
    C.append([]) i range(len(B)) range len(B) len B C.append([]) C.append C append [] for i in range(len(B)):
    for j in range(len(SP)):
        if B[i]==SP[j][0]:
            C[i].append([int(SP[j][1]),SP[j][2]]) i range(len(B)) range len(B) len B for j in range(len(SP)):
        if B[i]==SP[j][0]:
            C[i].append([int(SP[j][1]),SP[j][2]]) j range(len(SP)) range len(SP) len SP if B[i]==SP[j][0]:
            C[i].append([int(SP[j][1]),SP[j][2]]) B[i]==SP[j][0] B[i] B i SP[j][0] [j] SP j 0 C[i].append([int(SP[j][1]),SP[j][2]]) [i].append [i] C i append [int(SP[j][1]),SP[j][2]] int(SP[j][1]) int SP[j][1] [j] SP j 1 SP[j][2] [j] SP j 2 for i in range(len(C)):
    for j in range(1,len(C[i])):
        d=C[i][j]
        k=j-1
        while (k>=0 and C[i][k]<d):
            C[i][k+1]=C[i][k]
            k-=1
        C[i][k+1]=d i range(len(C)) range len(C) len C for j in range(1,len(C[i])):
        d=C[i][j]
        k=j-1
        while (k>=0 and C[i][k]<d):
            C[i][k+1]=C[i][k]
            k-=1
        C[i][k+1]=d j range(1,len(C[i])) range 1 len(C[i]) len C[i] C i d=C[i][j] d C[i][j] [i] C i j k=j-1 k j-1 j 1 while (k>=0 and C[i][k]<d):
            C[i][k+1]=C[i][k]
            k-=1
         k>=0 and C[i][k]<d k>=0 k 0 C[i][k]<d C[i][k] [i] C i k d C[i][k+1]=C[i][k] C[i][k+1] [i] C i k+1 k 1 C[i][k] [i] C i k k-=1 k 1 C[i][k+1]=d C[i][k+1] [i] C i k+1 k 1 d for i in range(len(C)):
    for j in range(len(C[i])):
        print(C[i][j][1]) i range(len(C)) range len(C) len C for j in range(len(C[i])):
        print(C[i][j][1]) j range(len(C[i])) range len(C[i]) len C[i] C i print(C[i][j][1]) print C[i][j][1] [j] [i] C i j 1 k-=1 1 k A=[] [] A N=int(input()) int(input()) N SP=[] [] SP B=[] [] B C=[] [] C d=C[i][j] C[i][j] d k=j-1 j-1 k
N=int(input())
SP=[]
for i in range(N):
    SP.append(list(input().split()))
for i in range(N):
    SP[i].append(i+1)
A=[]
B=[]
C=[]
for i in range(N):
    A.append(SP[i][0])
A.sort()
B.append(A[0])
for i in range(0,N-1):
    if A[i]!=A[i+1]:
        B.append(A[i+1])
for i in range(len(B)):
    C.append([])
for i in range(len(B)):
    for j in range(len(SP)):
        if B[i]==SP[j][0]:
            C[i].append([int(SP[j][1]),SP[j][2]])
for i in range(len(C)):
    for j in range(1,len(C[i])):
        d=C[i][j]
        k=j-1
        while (k>=0 and C[i][k]<d):
            C[i][k+1]=C[i][k]
            k-=1
        C[i][k+1]=d
for i in range(len(C)):
    for j in range(len(C[i])):
        print(C[i][j][1])