namespace AtCoder; #nullable enable using System.Numerics; static class Extensions { public static T[] Repeat(this int time, Func F) => Enumerable.Range(0, time).Select(_ => F()).ToArray(); } class AtCoder { object? Solve() { var n = Int(); var s = String(); var t = String(); var az = n.Repeat(Int); var sl = s.Length; var tl = t.Length; var max = az.Max(); var sc = (max + 1).Repeat(() => -1); for (var i = 0; i * tl <= max; i++) { if (sc[i * tl] >= 0) continue; var c = 0; for (var j = i * tl; j <= max; j += sl) sc[j] = c++; } foreach (var a in az) { var so = sc[a]; var to = (a - so * sl) / tl; var row = new List(); for (var i = 0; i < so; i++) row.Add(s); for (var i = 0; i < to; i++) row.Add(t); Out(row, " "); } return null; } public static void Main() => new AtCoder().Run(); public void Run() { var res = Solve(); if (res != null) { if (res is bool yes) res = yes ? "Yes" : "No"; sw.WriteLine(res); } sw.Flush(); } string[] input = Array.Empty(); int iter = 0; readonly StreamWriter sw = new(Console.OpenStandardOutput()) { AutoFlush = false }; string String() { while (iter >= input.Length) (input, iter) = (Console.ReadLine()!.Split(' '), 0); return input[iter++]; } T Input() where T : IParsable => T.Parse(String(), null); int Int() => Input(); void Out(object? x, string? separator = null) { separator ??= Environment.NewLine; if (x is System.Collections.IEnumerable obj and not string) { var firstLine = true; foreach (var item in obj) { if (!firstLine) sw.Write(separator); firstLine = false; sw.Write(item); } } else sw.Write(x); sw.WriteLine(); } }