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 final class spy_syndrome_2
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static int n,m;
	static char[] a;
	static TrieNode root=new TrieNode();
	static int[] dp,val;
	static String[] s1;
	
	static void insert(TrieNode curr_node,char[] arr,int idx)
	{
		for(int i=0;i<arr.length;i++)
		{
			TrieNode child=curr_node.children[arr[i]-'a'];
			if(child==null)
			{
				child=curr_node.children[arr[i]-'a']=new TrieNode();
			}
			curr_node=child;
		}
		curr_node.idx=idx;
	}
	
	static int solve(int idx)
	{
		if(idx>=n)
		{
			return 1;
		}
		if(dp[idx]!=-1)
		{
			return dp[idx];
		}
		else
		{
			TrieNode curr_node=root;int idx1=idx;int curr=0;
			while(idx1<n)
			{
				TrieNode child=curr_node.children[a[idx1]-'a'];
				if(child==null)
				{
					break;
				}
				curr_node=child;
				if(curr_node.idx!=-1 && solve(idx1+1)==1)
				{
					val[idx]=curr_node.idx;curr=1;break;
				}
				idx1++;
			}
			dp[idx]=curr;return dp[idx];
		}
	}
	
	static void print(int idx)
	{
		if(idx>=n)
		{
			return;
		}
		else
		{
			print(idx+s1[val[idx]].length());out.print(s1[val[idx]]+" ");
		}
	}
	
	public static void main(String args[]) throws Exception
	{
		n=sc.nextInt();a=sc.next().toCharArray();m=sc.nextInt();s1=new String[m];
		for(int i=0;i<m;i++)
		{
			s1[i]=sc.next();char[] arr=s1[i].toLowerCase().toCharArray();insert(root,arr,i);
		}
		for(int i=0,j=a.length-1;i<j;i++,j--)
		{
			char temp=a[i];a[i]=a[j];a[j]=temp;
		}
		dp=new int[n];val=new int[n];Arrays.fill(val,-1);Arrays.fill(dp,-1);solve(0);print(0);out.close();
	}
}
class TrieNode
{
	TrieNode[] children=new TrieNode[26];int idx=-1;
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}