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.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
 
public class Main {
	public static void main(String[] args) throws NumberFormatException,
	IOException {Solve solve = new Solve();solve.solve();}
}
class Solve{
	void dump(int[]a){for(int i=0;i<a.length;i++)System.out.print(a[i]+" ");System.out.println();}
	void dump(int[]a,int n){for(int i=0;i<a.length;i++)System.out.printf("%"+n+"d",a[i]);System.out.println();}
	void dump(long[]a){for(int i=0;i<a.length;i++)System.out.print(a[i]+" ");System.out.println();}
	void dump(char[]a){for(int i=0;i<a.length;i++)System.out.print(a[i]);System.out.println();}
	String itob(int a,int l){return String.format("%"+l+"s",Integer.toBinaryString(a)).replace(' ','0');}
	void solve() throws NumberFormatException, IOException{
		final ContestScanner in = new ContestScanner();
		Writer out = new Writer();
		int n = in.nextInt();
		char[] s = in.nextToken().toCharArray();
		int m = in.nextInt();
		HashMap<Str, String> word = new HashMap<>();
		HashMap<String, Integer> id = new HashMap<>();
		String[] w = new String[m];
		for(int i=0; i<m; i++){
			String str = in.nextToken();
			id.put(str, i);
			w[i] = str;
			Str v = new Str(str, i);
			word.put(v, str);
		}
		Str seeker = new Str("", -1);
		int[] bf = new int[n+1];
		int[] use = new int[n+1];
		for(int i=1; i<=n; i++){
			use[i] = -1;
		}
		BitSet used = new BitSet(n);
		Queue<Integer> qu = new PriorityQueue<>();
		qu.add(0);
		while(!qu.isEmpty()){
			int i = -qu.poll();
			if(i==n) break;
			seeker.clear();
			for(int j=i; j<n; j++){
				seeker.add(s[j]);
				if(word.containsKey(seeker)){
					int idx = id.get(word.get(seeker));
					use[j+1] = idx;
					bf[j+1] = i;
					if(used.get(j+1)) continue;
					used.set(j+1);
					qu.add(-(j+1));
				}
			}
		}
		int idx = n;
		List<Integer> list = new ArrayList<>();
		while(idx!=0){
			list.add(use[idx]);
			idx = bf[idx];
		}
		Collections.reverse(list);
		StringBuilder sb = new StringBuilder();
		for(int i: list){
			sb.append(w[i]);
			sb.appendCodePoint(' ');
		}
		out.write(sb.toString().trim());
		out.close();
	}
}

class Str{
	StringBuilder token;
	CharSequence cs;
	int hash;
	int id;
	Str(String o, int id){
		this.id = id;
		hash = 0;
		char[] t = o.toLowerCase().toCharArray();
		char[] tmp = new char[t.length];
		for(int j=0; j<t.length; j++){
			tmp[j] = t[t.length-j-1];
			hash = hash*27 + tmp[j]-'a';
		}
		token = new StringBuilder(String.valueOf(tmp));
	}
	void clear(){
		hash = 0;
		token.setLength(0);
	}
	void add(char c){
		hash = hash*27 + c-'a';
		token.appendCodePoint(c);
	}
	@Override
	public int hashCode() {
		return hash;
	}
	@Override
	public boolean equals(Object arg0) {
		Str s = (Str)arg0;
		if(token.length() != s.token.length()) return false;
		for(int i=0; i<token.length(); i++){
			if(token.charAt(i)!=s.token.charAt(i)) return false;
		}
		return true;
	}
}

class MultiSet<T> extends HashMap<T, Integer>{
	@Override
	public Integer get(Object key){return containsKey(key)?super.get(key):0;}
	public void add(T key,int v){put(key,get(key)+v);}
	public void add(T key){put(key,get(key)+1);}
	public void sub(T key)
	{final int v=get(key);if(v==1)remove(key);else put(key,v-1);}
}
class Timer{
	long time;
	public void set(){time=System.currentTimeMillis();}
	public long stop(){return time=System.currentTimeMillis()-time;}
	public void print()
	{System.out.println("Time: "+(System.currentTimeMillis()-time)+"ms");}
	@Override public String toString(){return"Time: "+time+"ms";}
}
class Writer extends PrintWriter{
	public Writer(String filename)throws IOException
	{super(new BufferedWriter(new FileWriter(filename)));}
	public Writer()throws IOException{super(System.out);}
}
class ContestScanner {
	private InputStreamReader in;private int c=-2;
	public ContestScanner()throws IOException 
	{in=new InputStreamReader(System.in);}
	public ContestScanner(String filename)throws IOException
	{in=new InputStreamReader(new FileInputStream(filename));}
	public String nextToken()throws IOException {
		StringBuilder sb=new StringBuilder();
		while((c=in.read())!=-1&&Character.isWhitespace(c));
		while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
		return sb.toString();
	}
	public String readLine()throws IOException{
		StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
		while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
		return sb.toString();
	}
	public long nextLong()throws IOException,NumberFormatException
	{return Long.parseLong(nextToken());}
	public int nextInt()throws NumberFormatException,IOException
	{return(int)nextLong();}
	public double nextDouble()throws NumberFormatException,IOException 
	{return Double.parseDouble(nextToken());}
}