input() s = input() p = list(map(int, input().split())) res = "" for x in p: res += s[x-1] print(res)