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