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 q4 {
	public static void main(String[] args) throws Exception
	{
		InputReader in=new InputReader(System.in);
		PrintWriter pw=new PrintWriter(System.out);
		int n=in.nextInt();
		String s=in.readString();
		int m=in.nextInt();
		trie t=new trie();
		String[] arr=new String[m];
		for(int i=0;i<m;i++)
		{
			String w=in.readString();
			arr[i]=w;
			StringBuilder ss=new StringBuilder(w.toLowerCase());
			String temp=ss.reverse().toString();
		
				t.insert(temp,i);
			
		}
		boolean[] ar=new boolean[n+1];
		int[] size=new int[n+2];
		int[] index=new int[n+2];
		int min=n-1;
		ar[n]=true;
		for(int i=n-1;i>=0;i--)
		{
		
				//t.find(s.substring(i,n), i,ar,size,index);
				trienode current=t.root;
				for(int k=0;i+k<n;k++)
				{
					if(current.child[s.charAt(i+k)-'a']==null)
					{
			
					break;
					}
					current=current.child[s.charAt(i+k)-'a'];
					if(current.isend)
					{
						
						if(ar[i+k+1])
						{
							
						ar[i]=true;
						int w=i+k;
						size[i]=w-i+1;
						index[i]=current.ind;
						break;
						}
					}
				}

		}

		int i=0;
		while(i<n)
		{
			
			pw.print(arr[index[i]]+" ");
			i=i+size[i];
		
		}
		
		pw.close();
	}
	
	
	
	
	
	
	
	
	 static class InputReader {

		private InputStream stream;
		private byte[] buf = new byte[8192];
		private int curChar;
		private int snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}

			int res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));

			return res * sgn;
		}
		
		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}

			long res = 0;

			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));

			return res * sgn;
		}
		
		public String readString() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

}
class trie
{
	trienode root;
	public trie()
	{
		root=new trienode();
	}
	public  void insert(String s,int ind)
	{
		trienode current=root;
		for(int i=0;i<s.length();i++)
		{
			if(current.child[s.charAt(i)-'a']==null)
			{
			current.child[s.charAt(i)-'a']=new trienode();
			}
			current=current.child[s.charAt(i)-'a'];
		}
		current.isend=true;
		current.ind=ind;
	}
	public void find(String s,int indx,boolean[] ar,int[] size,int[] index)
	{
	
		trienode current=root;
		for(int i=0;i<s.length();i++)
		{
			if(current.child[s.charAt(i)-'a']==null)
			{
	
				return ;
			}
			current=current.child[s.charAt(i)-'a'];
			if(current.isend)
			{
				
				if(ar[indx+i+1])
				{
					
				ar[indx]=true;
				int w=indx+i;
				size[indx]=w-indx+1;
				index[indx]=current.ind;
				return;
				}
			}
		}
		
		
	}
}
class trienode
{
	trienode[] child;
	boolean isend;
	int ind;
	public  trienode()
	{
		isend=false;
		child=new trienode[26];
	}
}