a = input() b = input() c = list(map(int,input().split())) ans = "" for i in c: ans += b[i-1] print(ans)