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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ATailouloute
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        QuickScanner in = new QuickScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        String s;
        String[] words;
        int[] idx;
        List<int[]> trie = new ArrayList<>();
        int[] word = new int[(int) (1e6 + 1)];
        int[] empty = new int[26];

        public void solve(int testNumber, QuickScanner in, PrintWriter out) {
            Arrays.fill(empty, -1);
            Arrays.fill(word, -1);
            trie.add(empty.clone());

            int n = in.nextInt();
            s = in.nextString();
            int m = in.nextInt();
            words = new String[m];
            for (int i = 0; i < m; i++) {
                words[i] = in.nextString();
                insert(i);
            }
            idx = new int[n];
            Arrays.fill(idx, -1);
            go(0);
            for (int i = 0; i < n; i++) {
                if (idx[i] != -1) go(i + 1);
                if (idx[n - 1] != -1) break;
            }
            List<Integer> ans = new ArrayList<>();
            int pos = n - 1;

            while (pos >= 0) {
                ans.add(idx[pos]);
                pos -= words[idx[pos]].length();
            }
            for (int i = ans.size() - 1; i >= 0; i--) {
                out.print(words[ans.get(i)] + " ");
            }
        }

        void go(int from) {
            if (from >= idx.length) return;
            int cur = 0;
            for (int i = from; i < idx.length; ++i) {
                int[] node = trie.get(cur);
                cur = node[posChar(s.charAt(i))];
                if (cur == -1) break;
                if (word[cur] != -1) {
                    idx[i] = word[cur];
                }
            }
        }

        private void insert(int x) {
            int cur = 0;
            for (int i = words[x].length() - 1; i >= 0; i--) {
                int[] node = trie.get(cur);
                if (node[posChar(words[x].charAt(i))] == -1) {
                    node[posChar(words[x].charAt(i))] = trie.size();
                    trie.add(empty.clone());
                }
                cur = node[posChar(words[x].charAt(i))];
            }
            word[cur] = x;
        }

        int posChar(char c) {
            return Character.isUpperCase(c) ? c - 'A' : c - 'a';
        }

    }

    static class QuickScanner {
        BufferedReader br;
        StringTokenizer st;
        InputStream is;

        public QuickScanner(InputStream stream) {
            is = stream;
            br = new BufferedReader(new InputStreamReader(stream), 32768);
        }

        public String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public String nextString() {
            return nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

    }
}