N = int(input()) S = input() P = list(map(int, input().split())) ans = [] for i in range(N): ans.append(S[P[i]-1]) print("".join(ans))