n = int(input()) S = input() P = [int(p)-1 for p in input().split()] T = "" for i in range(n): T += S[P[i]] print(T)