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. 

/**
 *
 * @author meashish
 */
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.InputMismatchException;

public class Main {

    InputReader in;
    Printer out;

    long MOD = 1000000007;

    private void start() throws Exception {
        int n = in.nextInt();
        String inp = in.next().toLowerCase();

        //HashMap<String, String> map = new HashMap<>();
        Node root = new Node('#');

        int m = in.nextInt();
        String words[] = new String[m];
        for (int i = 0; i < m; i++) {
            String str = in.next();
            words[i] = str;
            //map.put(str.toLowerCase(), str);

            add(str.toLowerCase(), root, i);
        }
        //dfs(root);
//        out.println();

        boolean mark[] = new boolean[n + 2];
        int pointer[] = new int[n + 2];
        Arrays.fill(pointer, -1);

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            sb.append(inp.charAt(i));

            boolean found = true;
            Node cur = root;
//            out.print(inp.charAt(i) + " : ");
            int ptr = 0;
            for (int j = i, k = 0; j >= 0 && k <= 1005; j--, k++) {
                int ch = sb.charAt(j) - 'a';
//                out.print(sb.charAt(j));

                if (cur.child[ch] == null) {
                    found = false;
                    break;
                }

                if (cur.child[ch].bool) {
                    if (mark[i - k] || (i - k) == 0) {
                        found = true;
                        ptr = j;
                        break;
                    } else {
                        found = false;
                    }
                } else {
                    found = false;
                }

                cur = cur.child[ch];
            }
//            out.println();
            mark[i + 1] = found;

            if (found) {
                pointer[i] = ptr;
            }
//            out.println("found: " + found);
        }

        ArrayList<String> list = new ArrayList<>();
        int cur = n - 1;
        StringBuilder ss = new StringBuilder();

//        for (int i = 0; i < n; i++) {
//            out.print(pointer[i] + " ");
//        }
//        out.println();
//        out.flush();
        
        while (cur >= 0) {
            int ptr = pointer[cur];
            //out.println(ptr + " " + cur);
//            out.flush();

            for (int i = ptr; i <= cur; i++) {
                ss.append(inp.charAt(i));
            }

            cur = ptr - 1;
            list.add(ss.reverse().toString());
            ss.setLength(0);
        }
        Collections.reverse(list);
        //out.println(list);
        for (int i = 0; i < list.size() - 1; i++) {
            out.print(words[get(list.get(i), root)]);
            out.print(" ");
        }
        out.print(words[get(list.get(list.size() - 1), root)]);
        out.println();
//        out.println(contains("is", root));
        out.flush();

    }

    void dfs(Node root) {
        out.print(root.val + " : ");
        for (Node ch : root.child) {
            if (ch != null) {
                out.print(ch.val + " ");
            }
        }
        out.println();
        for (Node ch : root.child) {
            if (ch != null) {
                dfs(ch);
            }
        }
    }

    class Node {

        char val;

        boolean bool = false;
        Node child[] = new Node[26];

        public Node(char val) {
            this.val = val;
        }
        int index = 0;
    }

    void add(String str, Node root, int ind) {
        Node cur = root;

        for (int i = 0; i < str.length(); i++) {
            int ch = str.charAt(i) - 'a';
            if (cur.child[ch] == null) {
                cur.child[ch] = new Node(str.charAt(i));
            }
            cur = cur.child[ch];
        }

        cur.bool = true;
        cur.index = ind;
    }

    boolean contains(String str, Node root) {
        Node cur = root;

        for (int i = 0; i < str.length(); i++) {
            int ch = str.charAt(i) - 'a';
            if (cur.child[ch] == null) {
                return false;
            }
            cur = cur.child[ch];
        }

        return cur.bool;
    }

    int get(String str, Node root) {
        Node cur = root;

        for (int i = 0; i < str.length(); i++) {
            int ch = str.charAt(i) - 'a';
            if (cur.child[ch] == null) {
                cur.child[ch] = new Node(str.charAt(i));
            }
            cur = cur.child[ch];
        }

        return cur.index;
    }

    BigInteger f(BigInteger b) {
        if (b == null) {
            return BigInteger.valueOf(0);
        }
        return b;
    }

    boolean check(int i, int n) {
        return i >= 0 && i < n;
    }

    long power(long x, long n) {
        if (n <= 0) {
            return 1;
        }
        long y = power(x, n / 2);

        if ((n & 1) == 1) {
            return (((y * y) % MOD) * x) % MOD;
        }

        return (y * y) % MOD;
    }

    public int gcd(int a, int b) {
        a = Math.abs(a);
        b = Math.abs(b);
        return BigInteger.valueOf(a).gcd(BigInteger.valueOf(b)).intValue();
    }

    public int[] input(int n) {
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }

        return a;
    }

    public int[] range(int start, int end) {
        int range[] = new int[end - start];

        for (int i = start; i < end; i++) {
            range[i - start] = i;
        }

        return range;
    }

    public static void main(String[] args) throws Exception {
        InputReader in;
        PrintStream out;

//        in = new InputReader(new FileInputStream(new File("in.txt")));
//        out = new PrintStream("out.txt");
        in = new InputReader(System.in);
        out = System.out;

        Main main = new Main();

        main.in = in;
        main.out = new Printer(out);

        main.start();
    }

    private static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, nextInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E') {
                        return res * Math.pow(10, nextInt());
                    }
                    if (c < '0' || c > '9') {
                        throw new InputMismatchException();
                    }
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

        public interface SpaceCharFilter {

            public boolean isSpaceChar(int ch);
        }
    }

    private static class Printer {

        PrintStream out;
        StringBuilder buffer = new StringBuilder();
        boolean autoFlush;

        public Printer(PrintStream out) {
            this.out = out;
        }

        public Printer(PrintStream out, boolean autoFlush) {
            this.out = out;
            this.autoFlush = autoFlush;
        }

        public void println() {
            buffer.append("\n");

            if (autoFlush) {
                flush();
            }
        }

        public void println(int n) {
            println(Integer.toString(n));
        }

        public void println(long n) {
            println(Long.toString(n));
        }

        public void println(double n) {
            println(Double.toString(n));
        }

        public void println(float n) {
            println(Float.toString(n));
        }

        public void println(boolean n) {
            println(Boolean.toString(n));
        }

        public void println(char n) {
            println(Character.toString(n));
        }

        public void println(byte n) {
            println(Byte.toString(n));
        }

        public void println(short n) {
            println(Short.toString(n));
        }

        public void println(Object o) {
            println(o.toString());
        }

        public void println(Object[] o) {
            println(Arrays.deepToString(o));
        }

        public void println(String s) {
            buffer.append(s).append("\n");

            if (autoFlush) {
                flush();
            }
        }

        public void print(char s) {
            buffer.append(s);

            if (autoFlush) {
                flush();
            }
        }

        public void print(String s) {
            buffer.append(s);

            if (autoFlush) {
                flush();
            }
        }

        public void flush() {
            try {
                BufferedWriter log = new BufferedWriter(new OutputStreamWriter(out));
                log.write(buffer.toString());

                log.flush();
                buffer = new StringBuilder();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    private class Pair<T, U> implements Serializable {

        int x;
        int index;
        int ans = 0;
        private T key;

        public T getKey() {
            return key;
        }

        private U value;

        public U getValue() {
            return value;
        }

        public Pair(T key, U value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public String toString() {
            return key + "=" + value;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }

            final Pair other = (Pair) obj;
            if (!this.key.equals(other.key)) {
                return false;
            }

            return this.value.equals(other.value);
        }

        @Override
        public int hashCode() {
            return key.hashCode() + 13 * value.hashCode();
        }
    }

    static ArrayList<int[]> permutations(int[] arr) {
        final ArrayList<int[]> resultList = new ArrayList<int[]>();
        final int l = arr.length;
        if (l == 0) {
            return resultList;
        }
        if (l == 1) {
            resultList.add(arr);
            return resultList;
        }

        int[] subClone = Arrays.copyOf(arr, l - 1);
        System.arraycopy(arr, 1, subClone, 0, l - 1);

        for (int i = 0; i < l; ++i) {
            int e = arr[i];
            if (i > 0) {
                subClone[i - 1] = arr[0];
            }
            final ArrayList<int[]> subPermutations = permutations(subClone);
            for (int[] sc : subPermutations) {
                int[] clone = Arrays.copyOf(arr, l);
                clone[0] = e;
                System.arraycopy(sc, 0, clone, 1, l - 1);
                resultList.add(clone);
            }
            if (i > 0) {
                subClone[i - 1] = e;
            }
        }
        return resultList;
    }

    private class Bit {

        int N;
        long ft[] = new long[10000000];

        Bit(int n) {
            N = n;
        }

        void update(int p, long v) {
            for (; p <= N; p += p & (-p)) {
                ft[p] += v;
                ft[p] %= MOD;
            }
        }

        void update(int a, int b, long v) {
            update(a, v);
            update(b + 1, -v);
        }

        long query(int b) {
            long sum = 0;
            for (; b > 0; b -= b & (-b)) {
                sum += ft[b];
                sum %= MOD;
            }

            return sum;
        }
    }
}
