#include using namespace std; int main() { int N; string S, T; cin >> N >> S >> T; for (int i = 0; i < N; i++) { int A, tots = 0, tott = 0; cin >> A; while (tots < A) tots += S.size(); while (tots + tott != A) { tots -= S.size(); while (tots + tott < A) tott += T.size(); } for (int j = 0; j < tots / (int)S.size(); j++) { if (j != 0) cout << ' '; cout << S; } for (int j = 0; j < tott / (int)T.size(); j++) { if (j != 0 || tots != 0) cout << ' '; cout << T; } cout << endl; } }