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.Arrays;
import java.util.ArrayList;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Tifuera
 */
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);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        String str = in.next();
        int[] encrypted = new int[n];
        for (int i = 0; i < n; i++) {
            encrypted[i] = str.charAt(i) - 'a';
        }

        int m = in.nextInt();
        String[] dictionary = new String[m];
        int maxLen = 0;
        for (int i = 0; i < m; i++) {
            dictionary[i] = in.next();
            maxLen = Math.max(dictionary[i].length(), maxLen);
        }

        Trie trie = new Trie();
        for (int i = 0; i < m; i++) {
            StringBuilder sb = new StringBuilder(dictionary[i].toLowerCase());
            trie.add(sb/*.reverse()*/.toString(), 0, i);
        }

        int[] dp = new int[encrypted.length + 1];
        Arrays.fill(dp, -1);
        dp[0] = 0;
        for (int i = 0; i < encrypted.length; i++) {
            Trie curTrie = trie;
            int j = i;
            while (j >= 0 && curTrie.tries[encrypted[j]] != null) {
                curTrie = curTrie.tries[encrypted[j]];
                if (curTrie.isWord && dp[j] != -1) {
                    dp[i + 1] = curTrie.endWordIdx;
                    break;
                }
                j--;
            }
        }
        List<String> answer = new ArrayList<>();
        int idx = dp.length - 1;
        while (idx > 0) {
            answer.add(dictionary[dp[idx]]);
            idx -= dictionary[dp[idx]].length();
        }
        for (int i = answer.size() - 1; i >= 0; i--) {
            out.print(answer.get(i) + " ");
        }
    }

    private static class Trie {
        private Trie[] tries;
        private int endWordIdx;
        private boolean isWord;

        public Trie() {
            tries = new Trie[26];
        }

        private void add(String str, int idx, int wordIdx) {
            if (idx == str.length()) {
                isWord = true;
                endWordIdx = wordIdx;
                return;
            }
            int charIdx = str.charAt(idx) - 'a';
            if (tries[charIdx] == null) {
                tries[charIdx] = new Trie();
            }

            tries[charIdx].add(str, idx + 1, wordIdx);
        }
    }

}

class InputReader {
    private BufferedReader reader;
    private String[] currentArray;
    private int curPointer;

    public InputReader(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
    }


    public String next() {
        try {
            currentArray = null;
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public int nextInt() {
        if ((currentArray == null) || (curPointer >= currentArray.length)) {
            try {
                currentArray = reader.readLine().split(" ");
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            curPointer = 0;
        }
        return Integer.parseInt(currentArray[curPointer++]);
    }

}