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.*;
import java.io.*;
import java.math.*;
public class Main
{
    static class Reader 
    { 
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} 
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];} 
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;} 
        public String s(){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 long l(){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 int i(){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 double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } 
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } 
        public int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = i();}return ret;}
    }
    
    
 
           //       |----|       /\      |    |   -----   |
           //       |   /       /  \     |    |     |     |
           //       |--/       /----\    |----|     |     |
           //       |   \     /      \   |    |     |     |
           //       |    \   /        \  |    |   -----   -------

    static int n;
    static String s;
    static long mulfac=41,mod=1000000007;
    static long hasharr[];
    static int cache[];
    static int reached=0;
    static long powerstore[];
    static HashSet<Long> hs[];
    static HashMap<Long,String> hm[];
    public static long inv(long x)
    {
    	long r,y;
    	for(r=1,y=mod-2;y>0;x=(x*x)%mod,y/=2)
    		if(y%2==1)
    			r=r*x%mod;
    	return r;
    }
    public static long power(long x,long y,long p)
    { 
        if(powerstore[(int)y]!=-1)
            return powerstore[(int)y];
        long res = 1;      
        x = x % p;  
        while (y > 0) 
        { 
            if((y & 1)==1) 
                res = (res * x) % p; 
            y = y >> 1;  
            x = (x * x) % p;  
        } 
        return powerstore[(int)y]=res; 
    } 
    public static int dp(int pos)
    {
        if(pos==n)
        {
            reached=1;
            return 1;
        }
        if(cache[pos]!=-1)
        return cache[pos];
        int ans=0;
        for(int i=1;i<=n;i++)
        {
            if(pos+i>n)
                break;
            long hash=(hasharr[pos]-(hasharr[pos+i]*power(mulfac,i,mod))%mod+3*mod)%mod;
            if(hs[i].contains(hash))
            ans|=dp(pos+i);
            if(reached==1)
            break;
        }
        return cache[pos]=ans;
    }
    static PrintWriter out;
    public static void path(int pos)
    {
        if(pos==n)
        {
            out.flush();
            System.exit(0);
        }
        for(int i=1;i<=n;i++)
        {
            if(pos+i>n)
                break;
            long hash=(hasharr[pos]-(hasharr[pos+i]*power(mulfac,i,mod))%mod+3*mod)%mod;
            if(hs[i].contains(hash))
            {
                if(dp(pos+i)==1)
                {
                    out.print(hm[i].get(hash)+" ");
                    path(pos+i);
                }
            }
        }
    }
    public static void main(String[] args)throws IOException
    {
        out= new PrintWriter(System.out);
        Reader sc=new Reader();
        n=sc.i();
        s=sc.s();
        int m=sc.i();
        hs=new HashSet[n+1];
        hm=new HashMap[n+1];
        for(int i=0;i<=n;i++)
        {
            hs[i]=new HashSet();
            hm[i]=new HashMap();
        }
        for(int j=0;j<m;j++)
        {
            String map=sc.s();
            StringBuilder ss=new StringBuilder(map.toLowerCase());
            ss=ss.reverse();
            long hashval=0;
            for(int i=ss.length()-1;i>=0;i--)
            {
                hashval=hashval*mulfac+ss.charAt(i)-96;
                if(hashval>=mod)
                hashval%=mod;
            }
            hs[map.length()].add(hashval);
            hm[map.length()].put(hashval,map);
        }
        hasharr=new long[n+1];
        long hashval=0;
        for(int i=n-1;i>=0;i--)
        {
            hashval=hashval*mulfac+s.charAt(i)-96;
            if(hashval>=mod)
            hashval%=mod;
            hasharr[i]=hashval;
        }
        powerstore=new long[n+1];
        Arrays.fill(powerstore,-1);
        cache=new int[n+1];
        Arrays.fill(cache,-1);
        dp(0);
        path(0);
        out.flush();
    }
}