N = gets.to_i S = gets P = gets.split.map(&:to_i) puts P.map { |i| S[i - 1] }.join