N = int(input()) S, T = input().split() A = list(map(int, input().split())) ans = [[] for _ in range(N)] for i in range(N): while A[i]%len(S) != 0: ans[i].append(T) A[i] -= len(T) while A[i] >= 1: ans[i].append(S) A[i] -= len(S) for a in ans: print(*a)