#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } #include using namespace atcoder; int main() { fast_io(); int n; cin >> n; string s, t; cin >> s >> t; int x = s.size(), y = t.size(); for (int i = 0; i < n; i++) { int a; cin >> a; for (int j = a / x; j >= 0; j--) { int res = a - j * x; if (res % y == 0) { int k = res / y; for (int l = 0; l < j; l++) { cout << s << " "; } for (int l = 0; l < k; l++) { cout << t << " "; } cout << endl; break; } } } }