N=int(input()) s=input() P=list(map(int,input().split())) for i in range(N): print(s[P[i]-1],end="") print()