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.util.*;
import java.io.*;

public class C {
    FastScanner in;
    PrintWriter out;

    static class Trie {
        static class Node {
            Map<Character, Node> ch;

            int index;
            Node() {
                ch = new TreeMap<>();
                index = -1;
            }

            Node go(char c) {
                if (!ch.containsKey(c)) {
                    Node n = new Node();
                    ch.put(c, n);
                    return n;
                } else {
                    return ch.get(c);
                }
            }
        }
        Node root;

        public Trie() {
            root = new Node();
        }

        public void add(char[] s, int index) {
            Node v = root;
            for (int i = 0; i < s.length; v = v.go(s[i]), i++);
            v.index = index;
        }
    }


    public void solve() throws IOException {
        int n = in.nextInt();
        char[] s = in.next().toCharArray();
        for (int i = 0, j = s.length - 1; i < j; i++, j--) {
            char tmp = s[i];
            s[i] = s[j];
            s[j] = tmp;
        }
        int m = in.nextInt();
        String[] words = new String[m];
        Arrays.setAll(words, i -> in.next());
        Trie trie = new Trie();
        for (int i = 0; i < m; i++) {
            trie.add(words[i].toLowerCase().toCharArray(), i);
        }
        int[] d = new int[n + 1];
        Arrays.fill(d, -1);
        d[n] = m;
        for (int i = n - 1; i >= 0; i--) {
            Trie.Node v = trie.root;
            for (int j = 0; i + j < d.length && i + j <= s.length; j++) {
                if (v == null) break;
                if (d[i + j] != -1 && v.index != -1) {
                    d[i] = v.index;
                    break;
                }
                if (i + j != s.length) v = v.ch.get(s[i + j]);
            }
        }
        int x = 0;
        List<String> ans = new ArrayList<>();
        while (d[x] != m) {
            ans.add(words[d[x]]);
            x = x + words[d[x]].length();
        }
        Collections.reverse(ans);
        for (int i = 0; i < ans.size(); i++) {
            if (i != 0) out.print(' ');
            out.print(ans.get(i));
        }
        out.println();
    }

    public void run() {
        try {
            in = new FastScanner(System.in);
            out = new PrintWriter(System.out);
            Locale.setDefault(Locale.US);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
    }

    public static void main(String[] arg) {
        new C().run();
    }
}