#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int n; string s, t; cin >> n >> s >> t; rep(_, n) { int a; cin >> a; for (int cnt = a / s.size(); cnt >= 0; --cnt) { int rem = a - cnt * s.size(); if (rem % t.size() == 0) { rep(__, cnt) cout << s << ' '; rep(__, rem / t.size()) cout << t << ' '; cout << endl; break; } } } return 0; }