#include #define rep(i,n) for(int i=0;i<(n);++i) using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; string s,t; cin >> s >> t; int a = s.size(); int b = t.size(); rep(i,n){ int c; cin >> c; int e,f; rep(j,c+1){ int d = c-b*j; if(d%a==0){ e = d/a; f = j; break; } } rep(j,e) cout << s << " "; rep(j,f) cout << t << " "; cout << endl; } }