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.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.io.*;
import java.util.*;

public class ManthanC2
{

private static StringTokenizer st;
    
    public static void nextLine(BufferedReader br) throws IOException
    {
        st = new StringTokenizer(br.readLine());
    }
    
    public static int nextInt()
    {
        return Integer.parseInt(st.nextToken());
    }
    
    public static String next()
    {
        return st.nextToken();
    }
    
    public static long nextLong()
    {
        return Long.parseLong(st.nextToken());
    }

    public static double nextDouble()
    {
        return Double.parseDouble(st.nextToken());
    }
    
    static long MOD1 = 1000000007;
    static long MOD2 = 1000000009;
    static long[] HEXP1 = new long[10002];
    static long[] HEXP2 = new long[10002];
    static HashMap<Long, HashMap<Long, Integer>> map;
    static int n;
    static int[] path;
    static String[] words;
    
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        nextLine(br);
        n = nextInt();
        nextLine(br);
        String t = next();
        char[] str = t.toCharArray();
        nextLine(br);
        int m = nextInt();
        words = new String[m];
        HEXP1[0] = 1;
        HEXP2[0] = 1;
        for (int i = 1; i < 10002; i++)
        {
            HEXP1[i] = modm(HEXP1[i-1], 29, MOD1);
            HEXP2[i] = modm(HEXP2[i-1], 29, MOD2);
        }
        
        map = new HashMap<Long, HashMap<Long, Integer>>(); 
        for (int i = 0; i < m; i++)
        {
            nextLine(br);
            words[i] = next();
            char[] tl = words[i].toLowerCase().toCharArray();
            long hash1 = hash(tl, MOD1);
            long hash2 = hash(tl, MOD2);
            add(hash1, hash2, i);
        }
        path = new int[n+1];
        Arrays.fill(path, -1);
        int[] idx = new int[n+1];
        Arrays.fill(idx, -1);
        for (int i = n-1; i >= 0; i--)
        {
            long hash1 = 0;
            long hash2 = 0;
            for (int j = 0; j < 1000 && i + j < n; j++)
            {
                hash1 = moda(hash1, modm(str[i+j] - '`', HEXP1[j], MOD1), MOD1);
                hash2 = moda(hash2, modm(str[i+j] - '`', HEXP2[j], MOD2), MOD2);
                int index = check(hash1, hash2);
                if (index != -1)
                {     
                    /*
                    if (words[index].length() != j+1)
                    {
                        System.out.println("COLLISION " + words[index] + " " + i + " " + j);
                        continue;
                    }
                    */
                    int dest = i + j + 1;
                    if (dest == n)
                    {
                        path[i] = n;
                        idx[i] = index;
                        break;
                    }
                    else if (path[dest] != -1)
                    {
                        path[i] = dest;
                        idx[i] = index;
                        break;
                    }
                }
            }
        }
        
        int ptr = 0;
        StringBuffer sb = new StringBuffer();
        while (ptr != n)
        {
            sb.append(words[idx[ptr]] + " ");
            ptr = path[ptr];
        }
        System.out.println(sb.toString());
    }
    
    
    public static void add(long hash1, long hash2, int index)
    {
        HashMap<Long, Integer> map2 = map.get(hash1);
        if (map2 == null)
        {
            map2 = new HashMap<Long, Integer>();
            map.put(hash1, map2);
        }
        /*
        if (map2.containsKey(hash2))
        {
            if (!words[map2.get(hash2)].equalsIgnoreCase(words[index]))
            {
                System.out.println("COLLISSION");
            }
        }
        */
        map2.put(hash2, index);
    }
    
    public static int check(long hash1, long hash2)
    {
        if (!map.containsKey(hash1))
        {
            return -1;
        }
        HashMap<Long, Integer> map2 = map.get(hash1);
        Integer val = map2.get(hash2);
        if (val == null)
        {
            return -1;
        }
        else
        {
            return val;
        }
    }
    
    private static long hash(char[] word, long mod)
    {
        long base = 1;
        long val = 0;
        for (int i = 0; i < word.length; i++)
        {
            val = moda(val, modm(base, word[word.length - i - 1] - '`', mod), mod);
            base = modm(base, 29, mod);
        }
        return val;
    }
    
    
    private static long modexp(long a, long b, long m)
    {
        long k = 1;
        while (b > 0)
        {
            if ((b & 1) == 1)
            {
                k = modm(a, k, m);
            }
            b = b >> 1;
            a = modm(a, a, m);
        }
        return k;
    }
    
    private static long modinv(long a, long m)
    {
        return modexp(a, m-2, m);
    }
    
    private static long moda(long a, long b, long m)
    {
        return (a+b) % m;
    }
    
    private static long modm(long a, long b, long m)
    {
        return ((a%m)*(b%m)) % m;
    }
    
    
}