N=int(input()) S,T=map(str,input().split()) A=list(map(int,input().split())) ans=[] for i in range(N): ans.append([]) for j in range(0,(A[i])//len(T)+1): if (A[i]-len(T)*j)%len(S)==0: count=(A[i]-len(T)*j)//len(S) for _ in range(count): ans[-1].append(S) for _ in range(j): ans[-1].append(T) break for a in ans: print(' '.join(a))