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.util.*;


public class Main {

    private static final double EPS = 1e-9;

    public static void main(String[] args) throws Exception{
        FastScanner fastScanner = new FastScanner(System.in);
        PrintWriter printWriter = new PrintWriter(System.out);
        Main main = new Main();
        main.solveC(fastScanner,printWriter);
        printWriter.close();

    }

    static final long MOD = Integer.MAX_VALUE;
    static final long base1 = 256;
    static final long base2 = 131;

    public long goodMod(long num, long mod){
        return (num%mod+mod)%mod;
    }

    public long findHash1(String str){
        long hash = 0;
        for(int i=0;i<str.length();i++)
            hash = goodMod(hash*base1+Character.toLowerCase(str.charAt(i)),MOD);
        return hash;
    }

    public long findHash2(String str){
        long hash = 0;
        for(int i=0;i<str.length();i++)
            hash = goodMod(hash*base2+Character.toLowerCase(str.charAt(i)),MOD);
        return hash;
    }

    public void solveC(FastScanner scanner, PrintWriter writer){
        int n = scanner.nextInt();
        String line = scanner.nextLine();
        int numOfWords = scanner.nextInt();
        HashMap<Long, String> set1 = new HashMap<>();
        HashMap<Long, String> set2 = new HashMap<>();
        HashMap<String, String> set = new HashMap<>();
        int maxLength = 0;
        for(int i=0;i<numOfWords;i++){
            String a = scanner.nextLine();
            set1.put(findHash1(a),a);
            set2.put(findHash2(a),a);
            set.put(a.toLowerCase(),a);
            if(maxLength<a.length()) maxLength=a.length();
        }
        StringBuffer strbf = new StringBuffer(line);
        strbf.reverse();
        int dp[] = new int[strbf.length()+1];
        Arrays.fill(dp,-1);
        dp[strbf.length()]=Integer.MAX_VALUE;
        for(int i=strbf.length()-1;i>=0;i--){
            int j=0;
//            StringBuffer nextStr = new StringBuffer(maxLength);
            long hash1=0,hash2=0;
            for(j=i+1;j<=strbf.length()&&(j-i)<=maxLength;j++){
//                nextStr.append(strbf.charAt(j-1));
                hash1 = goodMod(hash1*base1+strbf.charAt(j-1),MOD);
                hash2 = goodMod(hash2*base2+strbf.charAt(j-1),MOD);
                if(dp[j]!=-1&&set1.containsKey(hash1)&&set2.containsKey(hash2)) {
                    dp[i]=j;
                    break;
                }
            }
        }
        Deque<String> stack = new ArrayDeque<>();
        int i=0;
        while(dp[i]!=Integer.MAX_VALUE){
            stack.push(set.get(strbf.substring(i,dp[i])));
            i=dp[i];
        }
        boolean flag = false;
        while(!stack.isEmpty()){
            if(flag) writer.printf(" ");
            flag=true;
            writer.printf("%s",stack.removeFirst());
        }
        writer.printf("\n");
    }



    public void solveA(FastScanner scanner, PrintWriter writer){
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();

        for(int i=0;;i++){
            int k = i*a;
            if(k>c) break;
            int r = c-k;
            if(r%b==0){
                writer.printf("Yes\n");
                return;
            }
        }
        writer.printf("No\n");

    }

    int findNumberOfTrailingZero(long num){
        int cnt = 0;
        long val = 5;
        while(val<=num){
            cnt+=num/val;
            val = val*5;
        }
        return cnt;
    }

    public void solveB(FastScanner scanner, PrintWriter writer){
        int m = scanner.nextInt();
        int l=1,r=Integer.MAX_VALUE;
//        writer.printf("%d\n",findNumberOfTrailingZero(Integer.MAX_VALUE));
        while(l<r){
            int mid = l+(r-l)/2;
            int cnt = findNumberOfTrailingZero(mid);
            if(cnt<m) l = mid+1;
            else r=mid;
        }
        int cnt = findNumberOfTrailingZero(l);
        if(cnt==m){
            writer.printf("%d\n%d %d %d %d %d\n",5,l,l+1,l+2,l+3,l+4);
        }else{
            writer.printf("0\n");
        }
    }

    static class Pair<Type>{
        Type first,second;
        public Pair(Type first, Type second){
            this.first = first;
            this.second = second;
        }
    }


    static class Point{
        long x,y;
        public Point(long x, long y){
            this.x = x;
            this.y = y;
        }
    }

    long twoTimesAreaOfTriangle(Point a, Point b, Point c) {
        long ar = a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y);
        if(ar<0) ar=ar*(-1);
        return ar;
    }

    boolean isCisOnAB(Point a, Point b, Point c){
        long cross =  (c.y - a.y) * (b.x - a.x) - (c.x - a.x) * (b.y - a.y);
        if(cross!=0) return false;
        long dotproduct = (c.x - a.x) * (b.x - a.x) + (c.y - a.y)*(b.y - a.y);
        if(dotproduct < 0)
            return false;
        long squaredlengthba = (b.x - a.x)*(b.x - a.x) + (b.y - a.y)*(b.y - a.y);
        if (dotproduct > squaredlengthba) return false;

        return true;

    }


    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

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

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

            return tokenizer.nextToken("\n");
        }

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

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

        public double nextDoube()  {
            return Double.parseDouble(next());
        }

    }


}