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

/**
 * 633C
 * O(n^2 + Σ(|word_i|)) time
 * O(n + Σ(|word_i|)) space
 *
 * @author artyom
 */
public class _633CFaster implements Runnable {
    private BufferedReader in;
    private StringTokenizer tok;
    private String text;
    private List<String> lowercaseWordList;
    private CompressedKeywordTreeNode root;
    private boolean[] dp;
    private Deque<Integer> trace;

    private Object solve() throws IOException {
        int n = nextInt();
        text = nextToken();
        List<String> words = new ArrayList<>();
        lowercaseWordList = new ArrayList<>();
        Set<String> lowercaseWords = new HashSet<>();
        root = new CompressedKeywordTreeNode(0, 0, 0, null, false);
        for (int i = 0, m = nextInt(); i < m; i++) {
            String word = nextToken();
            String lowercaseWord = word.toLowerCase();
            if (lowercaseWords.add(lowercaseWord)) {
                words.add(word);
                String s = lowercaseWord + "{";
                lowercaseWordList.add(s);
                addToTree(s, words.size() - 1);
            }
        }
        preprocessTree(root);
        dp = new boolean[n];
        trace = new LinkedList<>();
        find(n - 1);
        StringBuilder sb = new StringBuilder();
        for (int p : trace) {
            sb.append(words.get(p)).append(' ');
        }
        return sb;
    }

    private static void preprocessTree(CompressedKeywordTreeNode node) {
        for (CompressedKeywordTreeNode ch : node.children) {
            if (ch != null) {
                if (ch.children == null) {
                    if (ch.end - ch.start == 1) {
                        node.terminalChild = ch;
                    }
                } else {
                    preprocessTree(ch);
                }
            }
        }
    }

    private boolean find(int i) {
        if (i < 0) {
            return true;
        }
        int k = i;
        if (!dp[k]) {
            out:
            for (CompressedKeywordTreeNode node = root; i >= 0; ) {
                CompressedKeywordTreeNode next = node.children[text.charAt(i) - 'a'];
                if (next == null) {
                    break;
                }
                String word = lowercaseWordList.get(next.wordNumber);
                for (int j = next.start; j < next.end; j++, i--) {
                    if (i < 0 || word.charAt(j) != text.charAt(i)) {
                        if (next.children == null && j == next.end - 1) {
                            trace.push(next.wordNumber);
                            if (find(i)) {
                                return true;
                            }
                            trace.pop();
                        }
                        break out;
                    }
                }
                if (next.terminalChild != null) {
                    trace.push(next.terminalChild.wordNumber);
                    if (find(i)) {
                        return true;
                    }
                    trace.pop();
                }
                node = next;
            }
        }
        dp[k] = true;
        return false;
    }

    //--------------------------------------------------------------
    public static void main(String[] args) {
        new _633CFaster().run();
    }

    @Override
    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            tok = null;
            System.out.print(solve());
            in.close();
        } catch (IOException e) {
            System.exit(0);
        }
    }

    private String nextToken() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private void addToTree(String s, int number) {
        int i = 0, n = s.length();
        CompressedKeywordTreeNode node = root;
        while (true) {
            int b = s.charAt(i) - 'a';
            CompressedKeywordTreeNode next = node.children[b];
            if (next == null) {
                node.children[b] = new CompressedKeywordTreeNode(i, n, number, node, true);
                return;
            } else {
                String word = lowercaseWordList.get(next.wordNumber);
                for (int j = next.start; j < next.end; j++, i++) {
                    if (word.charAt(j) != s.charAt(i)) {
                        // Split
                        CompressedKeywordTreeNode splitNode = new CompressedKeywordTreeNode(next.start, j, next.wordNumber, node, false);
                        splitNode.parent.children[b] = splitNode;
                        splitNode.children[word.charAt(j) - 'a'] = next;
                        next.parent = splitNode;
                        splitNode.children[s.charAt(i) - 'a'] = new CompressedKeywordTreeNode(i, n, number, splitNode, true);
                        next.start = j;
                        return;
                    }
                }
                node = next;
            }
        }
    }

    private static final class CompressedKeywordTreeNode {
        //int depth; // The number of characters from root to this node
        int start; // Inclusive
        int end; // Exclusive
        int wordNumber;
        CompressedKeywordTreeNode parent;
        CompressedKeywordTreeNode terminalChild;
        final CompressedKeywordTreeNode[] children;

        private CompressedKeywordTreeNode(int start, int end, int wordNumber, CompressedKeywordTreeNode parent, boolean leaf) {
            this.start = start;
            this.end = end;
            this.parent = parent;
            this.wordNumber = wordNumber;
            //this.depth = depth;
            if (leaf) {
                // Save some space and time
                this.children = null;
            } else {
                this.children = new CompressedKeywordTreeNode[27];
            }
        }

        @Override
        public String toString() {
            return "(" + start + ',' + (end - 1) + ')';
        }
    }
}