N = int(input()) S, T = input().split() A = list(map(int,input().split())) s = len(S) t = len(T) r = t % s ans = [list() for i in range(N)] for i in range(N): if A[i] % s == 0: for j in range(A[i] // s): ans[i].append(S) else: p = A[i] % s cnt = 0 while p % s != 0: p -= r ans[i].append(T) cnt += 1 for j in range((A[i]-t*cnt)//s): ans[i].append(S) for i in range(N): print(*ans[i])