N=5 A=list(map(int,input().split())) B=list(map(int,input().split())) C=[0]*N for i in range(N): C[i]=A[B[i]-1] print(*C)