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


public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solve(in, out);
        out.close();
    }

    static String reverse(String s) {
        return (new StringBuilder(s)).reverse().toString();
    }

    static void sort(int ar[]) {
        int n = ar.length;
        ArrayList<Integer> a = new ArrayList<>();
        for (int i = 0; i < n; i++)
            a.add(ar[i]);
        Collections.sort(a);
        for (int i = 0; i < n; i++)
            ar[i] = a.get(i);
    }

    static long ncr(long n, long r, long mod) {
        if (r == 0)
            return 1;
        long val = ncr(n - 1, r - 1, mod);
        val = (n * val) % mod;
        val = (val * modInverse(r, mod)) % mod;
        return val;
    }

    

    public static void solve(InputReader sc, PrintWriter pw) {
        int i, j = 0;
        int t = 1;
        // int t = sc.nextInt();
        u: while (t-- > 0) {
            int n=sc.nextInt();
            String s=sc.next();
            int m=sc.nextInt();
            String word[]=new String[m];
            HashMap<String,String> h=new HashMap<>();
            for(i=0;i<m;i++){
                word[i]=sc.next();
                String g=word[i].toLowerCase();
                if(!h.containsKey(g));
                    h.put(g,word[i]);
                word[i]=reverse(g);
            }
            Trie ob=new Trie(word);
            int y[]=new int[n+1];
            y[0]=1;
            int last=1;
            for(;last<=n;last++){
                if(y[last-1]==0)
                    continue;
                Node node = ob.root;
                // for(i=0;i<26;i++){
                //     System.out.println(i+" "+node.values[i]);
                // }
                // break;
                for(j=last-1;j<n;j++){
                    int z=s.charAt(j)-97;
                    // System.out.println(s.substring(last-1,j+1));
                    if(node.values[z]==null){
                        break;
                    }
                    node=node.values[z];
                    if(node.end==true){
                        y[j+1]=j+2-last;
                        // System.out.println("Reached");
                    }
                }
                // System.out.println(last+" "+j);
            }
            // for(i=1;i<=n;i++){
            //     System.out.println(i+" "+y[i]);
            // }
            last=n;
            ArrayList<String> ar=new ArrayList<>();
            while(last>0){
                j=last-y[last];
                ar.add(reverse(s.substring(j,last)));
                last=j;
                // System.out.println(last);
            }
            for(i=ar.size()-1;i>=0;i--)
                pw.print(h.get(ar.get(i))+" ");
            pw.println();
        }
    }

    static class Pair implements Comparable<Pair> {
        int a;
        int b;
        int c;
        
        Pair(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        public int compareTo(Pair p) {
            if (c != p.c)
                return -1*(c - p.c);
            return (a - p.a);
        }
    }

    static boolean isPrime(long n) {
        if (n <= 1)
            return false;
        if (n <= 3)
            return true;
        if (n % 2 == 0 || n % 3 == 0)
            return false;
        for (int i = 5; i * i <= n; i = i + 6)
            if (n % i == 0 || n % (i + 2) == 0)
                return false;
        return true;
    }

    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static long fast_pow(long base, long n, long M) {
        if (n == 0)
            return 1;
        if (n == 1)
            return base % M;
        long halfn = fast_pow(base, n / 2, M);
        if (n % 2 == 0)
            return (halfn * halfn) % M;
        else
            return (((halfn * halfn) % M) * base) % M;
    }

    static long modInverse(long n, long M) {
        return fast_pow(n, M - 2, M);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}

class Node{
    boolean end;
    Node values[];
    Node(){
        values = new Node[26];
        end = false;
    }
}

class Trie{
    Node root;
    Trie(String word[]){
        root = new Node();
        populate(root, word);
    }
    void populate(Node root, String word[]){
        Node node;
        for(int i=0;i<word.length;i++){
            node = root;
            for(int j=0;j<word[i].length();j++){
                int y=word[i].charAt(j)-97;
                if(node.values[y]==null){
                    node.values[y]=new Node();
                }
                node = node.values[y];
            }
            node.end = true;
        }
    }
}