Problem: After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After many weeks of observation of Siddhant’s sentences, Yash determined a new cipher technique.

For a given sentence, the cipher is processed as: 

  1. Convert all letters of the sentence to lowercase. 
  2. Reverse each of the words of the sentence individually. 
  3. Remove all the spaces in the sentence. 



For example, when this cipher is applied to the sentence

Kira is childish and he hates losing

the resulting string is

ariksihsidlihcdnaehsetahgnisol

Now Yash is given some ciphered string and a list of words. Help him to find out any original sentence composed using only words from the list. Note, that any of the given words could be used in the sentence multiple times.

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 10 000) — the length of the ciphered text. The second line consists of n lowercase English letters — the ciphered text t.

The third line contains a single integer m (1 ≤ m ≤ 100 000) — the number of words which will be considered while deciphering the text. Each of the next m lines contains a non-empty word wi (|wi| ≤ 1 000) consisting of uppercase and lowercase English letters only. It's guaranteed that the total length of all words doesn't exceed 1 000 000.

Output

Print one line — the original sentence. It is guaranteed that at least one solution exists. If there are multiple solutions, you may output any of those.

Examples

Input

30
ariksihsidlihcdnaehsetahgnisol
10
Kira
hates
is
he
losing
death
childish
L
and
Note


Output

Kira is childish and he hates losing 


Input

12
iherehtolleh
5
HI
Ho
there
HeLLo
hello


Output

HI there HeLLo 

Note

In sample case 2 there may be multiple accepted outputs, "HI there HeLLo" and "HI there hello" you may output any of them. 

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;

public class CF32 {

	static class Wd {
		String s;
		int ind;
		int p;

		public Wd(String st, int i, int prv) {
			s = st;
			ind = i;
			p = prv;
		}
	}

	static BufferedReader br;

	public static void main(String[] args) {
		br = new BufferedReader(new InputStreamReader(System.in));
		int m = -1;
		int ls = -1;
		String[] wd = null;
		try {
			int n = readInt();
			String txt = readString();
			m = readInt();
			wd = new String[m];
			String prv = "";

			HashMap<String, String> org = new HashMap<String, String>();
			int num = 0;
			for (int i = 0; i < m; i++) {

				String str = readString();
				String st = str.toLowerCase();
				//if (st.equals(prv))
					//continue;
				prv = st;

				int nm = st.length();
				wd[i] = "";
				for (int j = 0; j < nm; j++) {
					wd[i] += st.charAt(nm - j - 1);
				}
				org.put(wd[i], str);
				// System.out.println(wd[i]+" "+str);
				num++;
			}
			String[] wd2 = new String[num];
			System.arraycopy(wd, 0, wd2, 0, num);
			wd = wd2;
			Arrays.sort(wd);

			HashMap<String, Integer> hm = new HashMap<String, Integer>();
			for (int i = 0; i < wd.length; i++) {
				hm.put(wd[i], i);

				// System.out.println(wd[i]);
			}

			LinkedList<Wd> ll = new LinkedList<Wd>();
			ll.add(new Wd("", 0, -1));

			l: while (ll.size() > 0) {
				Wd wc = ll.removeLast();
				int ln = wc.s.length();
				// System.out.println(wc.s);
				int nind = ln + wc.ind;
				if (nind == n) {
					ll.add(wc);
					// System.out.println("here");
					break;
				} else {
					if (wc.p == -1) {
						for (int ei = nind; ei < n; ei++) {
							String sbs = txt.substring(nind, ei + 1);
							// System.out.println(sbs);
							if (hm.containsKey(sbs)) {
								int isv = hm.get(sbs);
								wc.p = isv;
								ll.add(wc);
								ll.add(new Wd(sbs, nind, -1));
								continue l;
							}
						}

					} else {
						l2: while (true) {
							wc.p++;
							if (wc.p == wd.length)
								continue l;
							String nw = wd[wc.p];
							int lnw = nw.length();
							if (nind + lnw > n)
								continue l2;
							for (int i = 0; i < lnw; i++) {
								if (nw.charAt(i) != txt.charAt(i + nind)) {
									continue l2;
								}
							}
							ll.add(wc);
							ll.add(new Wd(wd[wc.p], nind, -1));
							continue l;
						}

					}
				}

			}
			br.close();

			int nh = 0;
			ls = ll.size();
			while (nh < n) {
				Wd wrd = ll.removeFirst();
				String cr = wrd.s;
				if (cr.equals(""))
					continue;
				String or = org.get(cr);
				if (nh > 0) {
					System.out.print(" ");
				}
				System.out.print(or);
				nh += cr.length();
			}
			System.out.println();
		} catch (IOException e) {

			e.printStackTrace();
		} catch (java.util.NoSuchElementException e) {
			System.out.println(ls);
			System.out.println(m);
			for (int i = 0; i < m; i++) {
				System.out.println(wd[i]);
			}
		}
	}

	static public String readString() throws IOException {
		return br.readLine();

	}

	static public long readLong() throws IOException {
		return Long.parseLong(br.readLine());
	}

	static public int readInt() throws IOException {
		return Integer.parseInt(br.readLine());
	}

	static public int[] readIntArr() throws IOException {
		String[] str = br.readLine().split(" ");
		int arr[] = new int[str.length];
		for (int i = 0; i < arr.length; i++)
			arr[i] = Integer.parseInt(str[i]);
		return arr;
	}

	static public Integer[] readOIntArr() throws IOException {
		String[] str = br.readLine().split(" ");
		Integer arr[] = new Integer[str.length];
		for (int i = 0; i < arr.length; i++)
			arr[i] = new Integer(str[i]);
		return arr;
	}

	static public double[] readDoubleArr() throws IOException {
		String[] str = br.readLine().split(" ");
		double arr[] = new double[str.length];
		for (int i = 0; i < arr.length; i++)
			arr[i] = Double.parseDouble(str[i]);
		return arr;
	}

	static public Double[] readODoubleArr() throws IOException {
		String[] str = br.readLine().split(" ");
		Double arr[] = new Double[str.length];
		for (int i = 0; i < arr.length; i++)
			arr[i] = new Double(str[i]);
		return arr;
	}

	static public long[] readLongArr() throws IOException {
		String[] str = br.readLine().split(" ");
		long arr[] = new long[str.length];
		for (int i = 0; i < arr.length; i++)
			arr[i] = Long.parseLong(str[i]);
		return arr;
	}

	static public Long[] readOLongArr() throws IOException {
		String[] str = br.readLine().split(" ");
		Long arr[] = new Long[str.length];
		for (int i = 0; i < arr.length; i++)
			arr[i] = new Long(str[i]);
		return arr;
	}

	static public double readDouble() throws IOException {
		return Double.parseDouble(br.readLine());
	}
}