s = readline() p = parse.(Int, split(readline())) ans = join(s[idx] for idx ∈ p) println(ans)