import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String[] sa = br.readLine().split(" "); char[] s = sa[0].toCharArray(); char[] t = sa[1].toCharArray(); sa = br.readLine().split(" "); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = Integer.parseInt(sa[i]); } br.close(); int ls = s.length; int lt = t.length; PrintWriter pw = new PrintWriter(System.out); for (int i = 0; i < n; i++) { for (int j = a[i]; j >= 0; j--) { if (j % ls == 0 && (a[i] - j) % lt == 0) { int ts = j / ls; int tt = (a[i] - j) / lt; StringBuilder sb = new StringBuilder(); for (int k = 0; k < ts; k++) { sb.append(s).append(' '); } for (int k = 0; k < tt; k++) { sb.append(t).append(' '); } sb.deleteCharAt(sb.length() - 1); pw.println(sb.toString()); break; } } } pw.flush(); } }