#include using namespace std; int main(){ int N, M = 200010; string S, T; cin >> N >> S >> T; int s = S.size(), t = T.size(); vector dp(M, false); dp[0] = true; for (int i = 0; i < M; i++){ if (!dp[i]) continue; if (i+s < M) dp[i+s] = true; if (i+t < M) dp[i+t] = true; } while (N--){ int x; cin >> x; vector ans; while (x > 0){ if (x-s >= 0 && dp[x-s]){ ans.push_back(S); x -= s; } else{ ans.push_back(T); x -= t; } } for (auto s : ans) cout << s << ' '; cout << endl; } }