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.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Map;

public class P633C {
  InputStream is;
  PrintWriter out;
  String INPUT = "12\n" +
      "iherehtolleh\n" +
      "5\n" +
      "HI\n" +
      "he\n" +
      "Ho\n" +
      "there\n" +
      "HeLLo\n" +
      "hello";

  int[][] dict = new int[26][1000000];
  String[] hasWord = new String[1000000];
  List<List<String>> res = new ArrayList<>();
  int lastIndex = 0;
  Map<String, String> origWords = new HashMap<>();

  void put(String word) {
    int prevNext = 0;
    for (int i = 0; i < word.length(); i++) {
      int index = word.charAt(i) - 'a';
      int next = dict[index][prevNext];
      if (next == -1) {
        lastIndex++;
        dict[index][prevNext] = lastIndex;
        next = lastIndex;
      }
      prevNext = next;
      if (i + 1 == word.length()) {
        hasWord[next] = word; 
      }
    }
  }

  String get(String str, int start) {
    int pos = 0;
    for (int i = start; i < str.length(); i++) {
      int index = str.charAt(i) - 'a';
      int next = dict[index][pos];
      if (next == -1) {
        break;
      }
      if (hasWord[next] != null) {
        if (res.get(start) == null) {
          res.set(start, new ArrayList<String>());
        }
        res.get(start).add(hasWord[next]);
      }
      pos = next;
    }
    return null;
  }

  void solve() {
    for (int i = 0; i < 26; i++) {
      Arrays.fill(dict[i], -1);
    }
    ni();
    String str = ns();
    str = new StringBuilder(str.toLowerCase()).reverse().toString();
    res = new ArrayList<>(str.length());
    for (int i = 0; i < str.length(); i++) {
      res.add(null);
    }

    int n = ni();
    for (int i = 0; i < n; i++) {
      String word = ns();
      String lcWord = word.toLowerCase();
      origWords.put(lcWord, word);
      put(lcWord);
    }
    for (int i = 0; i < str.length(); i++) {
      get(str, i);
    }
    for (int i = 0; i < str.length(); i++) {
      if (res.get(i) != null) {
        Collections.reverse(res.get(i));
      }
    }
    dfs(0, str.length());
  }

  public boolean dfs(int pos, int end) {
    if (pos == end) return true;
    List<String> words = res.get(pos);
    if (words == null) {
      return false;
    }
    for (int i = 0; i < words.size(); i++) {
      if (dfs(pos + words.get(i).length(), end)) {
        out.print(origWords.get(words.get(i)) + " ");
        return true;
      }
    }
    return false;
  }

  public static void main(String[] args) throws Exception {
    new P633C().run();
  }
  
  void run() throws Exception {
    is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
    out = new PrintWriter(System.out);
  
    long s = System.currentTimeMillis();
    solve();
    out.flush();
    tr(System.currentTimeMillis() - s + "ms");
  }
  
  private byte[] inbuf = new byte[1024];
  private int lenbuf = 0, ptrbuf = 0;
  
  private int readByte() {
    if (lenbuf == -1)
      throw new InputMismatchException();
    if (ptrbuf >= lenbuf) {
      ptrbuf = 0;
      try {
        lenbuf = is.read(inbuf);
      } catch (IOException e) {
        throw new InputMismatchException();
      }
      if (lenbuf <= 0)
        return -1;
    }
    return inbuf[ptrbuf++];
  }
  
  private boolean isSpaceChar(int c) {
    return !(c >= 33 && c <= 126);
  }
  
  private int skip() {
    int b;
    while ((b = readByte()) != -1 && isSpaceChar(b))
      ;
    return b;
  }
  
  private double nd() {
    return Double.parseDouble(ns());
  }
  
  private char nc() {
    return (char) skip();
  }
  
  private String ns() {
    int b = skip();
    StringBuilder sb = new StringBuilder();
    while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }
  
  private char[] ns(int n) {
    char[] buf = new char[n];
    int b = skip(), p = 0;
    while (p < n && !(isSpaceChar(b))) {
      buf[p++] = (char) b;
      b = readByte();
    }
    return n == p ? buf : Arrays.copyOf(buf, p);
  }
  
  private char[][] nm(int n, int m) {
    char[][] map = new char[n][];
    for (int i = 0; i < n; i++)
      map[i] = ns(m);
    return map;
  }
  
  private int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }
  
  private int ni() {
    int num = 0, b;
    boolean minus = false;
    while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
      ;
    if (b == '-') {
      minus = true;
      b = readByte();
    }
  
    while (true) {
      if (b >= '0' && b <= '9') {
        num = num * 10 + (b - '0');
      } else {
        return minus ? -num : num;
      }
      b = readByte();
    }
  }
  
  private long nl() {
    long num = 0;
    int b;
    boolean minus = false;
    while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
      ;
    if (b == '-') {
      minus = true;
      b = readByte();
    }
  
    while (true) {
      if (b >= '0' && b <= '9') {
        num = num * 10 + (b - '0');
      } else {
        return minus ? -num : num;
      }
      b = readByte();
    }
  }
  
  private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
  
  private void tr(Object... o) {
    if (!oj)
      System.out.println(Arrays.deepToString(o));
  }
}