N = int(input()) S, T = input().split() A = [*map(int, input().split())] for a in A: s_cnt = 0 ans = (-1, -1) while s_cnt * len(S) <= a: if (a - s_cnt * len(S)) % len(T) == 0: ans = (s_cnt, (a - s_cnt * len(S)) // len(T)) s_cnt += 1 print(*([S]*ans[0]), *([T]*ans[1]))