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