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.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Task2 {

    public static void main(String[] args) throws IOException {

        new Task2().solve();

    }

    //ArrayList<Integer>[] g;

    int mod = 1000000007;

    PrintWriter out;

    int n;
    int m;
    //int[] a;
    long inf = Long.MAX_VALUE;

    //int[][] g = new int[110][110];



    void solve() throws IOException {

        //Reader in = new Reader("in.txt");
        //out = new PrintWriter( new BufferedWriter(new FileWriter("output.txt")) );
        Reader in = new Reader();
        PrintWriter out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );

        //BufferedReader br = new BufferedReader( new FileReader("in.txt") );
        //BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );

        trie[0] = new Node();

        int n = in.nextInt();

        String s = in.nextLine();

        int m = in.nextInt();
        String[] dict = new String[m];

        for (int i = 0; i < m; i++) {
            String w = in.nextLine();
            dict[i] = w;
            addString(w, i);
        }

        int[] d = new int[n+10];
        Pair[] p = new Pair[n+10];

        d[0] = 1;
        p[0] = new Pair(-1, -1);


        for (int i = 0; i < n; i++) {

            if (d[i] == 0)
                continue;

            int cur = 0;

            for (int j = i; j < n; j++) {

                int ch = s.charAt(j);
                ch = ch - 'a';

                if (trie[cur].next[ch] == 0)
                    break;

                cur = trie[cur].next[ch];

                if (trie[cur].leaf) {

                    //System.out.println(j + " " + trie[cur].ind);
                    d[j+1] = 1;
                    p[j+1] = new Pair(i, trie[cur].ind);

                }
            }
        }

        LinkedList<Integer> st = new LinkedList<>();

        Pair pcur = p[n];

        while (pcur.a != -1) {

            st.push(pcur.b);
            pcur = p[pcur.a];
        }

        while (!st.isEmpty()) {
            String w = dict[st.pop()];
            out.print(w+" ");
        }

        out.flush();
        out.close();
    }

    void addString(String s, int ind) {

        int cur = 0;

        for (int i = s.length()-1; i >= 0; i--) {

            int ch = s.charAt(i);
            if (ch >= 'A' && ch <= 'Z')
                ch = ch - 'A';
            else
                ch = ch - 'a';

            if (trie[cur].next[ch] == 0) {
                sz++;
                trie[sz] = new Node();
                trie[cur].next[ch] = sz;
            }

            cur = trie[cur].next[ch];

        }

        trie[cur].leaf = true;
        trie[cur].ind = ind;
    }

    Node[] trie = new Node[1000100];
    int sz = 0;

    class Node {

        int[] next = new int[26];
        boolean leaf = false;
        int ind = -1;

    }

    long gcd(long a, long b) {

        if (b == 0)
            return a;

        return gcd(b, a%b);

    }

    class Point implements Comparable<Point> {

        int x;
        int y;
        long d;

        Point(int x, int y, long d) {
            this.x = x;
            this.y = y;
            this.d = d;
        }

        @Override
        public int compareTo(Point o) {
            if (d > o.d)
                return 1;
            if (d < o.d)
                return -1;
            return 0;
        }
    }

    class Item {

        int a;
        int b;
        int c;

        Item(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

    }

    class Pair implements Comparable<Pair>{

        int a;
        int b;

        Pair(int a, int b) {

            this.a = a;
            this.b = b;
        }

        public int compareTo(Pair p) {

            if (a > p.a)
                return 1;

            if (a < p.a)
                return -1;

            if (b > p.b)
                return 1;

            if (b < p.b)
                return -1;

            return 0;
        }

        //		@Override
        //		public boolean equals(Object o) {
        //			Pair p = (Pair) o;
        //			return a == p.a && b == p.b;
        //		}
        //
        //		@Override
        //		public int hashCode() {
        //			return Integer.valueOf(a).hashCode() + Integer.valueOf(b).hashCode();
        //		}

    }

    class Reader {

        BufferedReader  br;
        StringTokenizer tok;

        Reader(String file) throws IOException {
            br = new BufferedReader( new FileReader(file) );
        }

        Reader() throws IOException {
            br = new BufferedReader( new InputStreamReader(System.in) );
        }

        String next() throws IOException {

            while (tok == null || !tok.hasMoreElements())
                tok = new StringTokenizer(br.readLine());
            return tok.nextToken();
        }

        int nextInt() throws NumberFormatException, IOException {
            return Integer.valueOf(next());
        }

        long nextLong() throws NumberFormatException, IOException {
            return Long.valueOf(next());
        }

        double nextDouble() throws NumberFormatException, IOException {
            return Double.valueOf(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

    }

}