#include #include using namespace std; using ll = long long; using ull = unsigned long long; using mint = atcoder::modint998244353; using maxt = atcoder::modint1000000007; vector Era(int N) { vector ans(0, 0); vector isprime(N + 1, true); isprime.at(1) = false; for(int i = 1; i <= N; i++) { if(isprime.at(i)) { ans.push_back(i); for(int j = 2 * i; j <= N; j += i) { isprime.at(j) = false; } } } return ans; } ll POW(ll a, int N) { if(N == 1) { return a; } ll ans = POW(a, N / 2) * POW(a, N / 2); if(N % 2 == 1) { ans *= a; } return ans; } //ライブラリここまで int main() { int N; string S, T; cin >> N >> S >> T; int s = S.size(), t = T.size(); for(int i = 0; i < N; i++) { int A; cin >> A; int t_cnt = 0; while(A % s != 0) { t_cnt++; A -= t; } for(int j = 0; j < A / s; j++) { cout << S; if(j == A / s - 1 && t_cnt == 0) { cout << endl; } else { cout << ' '; } } for(int j = 0; j < t_cnt; j++) { cout << T; if(j == t_cnt - 1) { cout << endl; } else { cout << ' '; } } } }