n = int(input()) s = input(); t = "" for v in map(int,input().split()): t += s[v-1] print(t)