def main(): N = int(input()) S, T = input().split() A = list(map(int, input().split())) for length in A: for t_ctr in range(length+1): if len(T) * t_ctr > length: raise ValueError if (length - len(T)*t_ctr) % len(S) == 0: s_ctr = (length - len(T)*t_ctr) // len(S) print(" ".join([S]*s_ctr), end="") if t_ctr > 0: if s_ctr > 0: print(end=" ") print(" ".join([T]*t_ctr), end="") print() break if __name__ == "__main__": main()