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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long binpow(long long a, long long b, long long m) {
  long long res = 1;
  a %= m;
  while (b) {
    if (b & 1) res = (res * a) % m;
    a = (a * a) % m;
    b >>= 1;
  }
  return res;
}
template <typename T>
class Hash {
 public:
  vector<long long> hf, hr, pw, ipw;
  long long p, m, n;
  Hash(T &s, long long p, long long m, long long n) : p(p), m(m), n(n) {
    hf.resize(n + 2);
    hr.resize(n + 2);
    pw.resize(n + 2);
    ipw.resize(n + 2);
    pw[0] = 1;
    for (long long i = 1; i <= n; i++) pw[i] = (pw[i - 1] * p) % m;
    ipw[n] = binpow(pw[n], m - 2, m);
    for (long long i = n - 1; i >= 0; i--) ipw[i] = (ipw[i + 1] * p) % m;
    hf[0] = 0;
    for (long long i = 1; i <= n; i++) hf[i] = (hf[i - 1] + s[i] * pw[i]) % m;
    hr[n + 1] = 0;
    for (long long i = n; i >= 1; i--)
      hr[i] = (hr[i + 1] + s[i] * pw[n - i + 1]) % m;
  }
  long long getf(long long l, long long r) {
    long long res = (hf[r] - hf[l - 1] + m) % m;
    res *= ipw[l - 1];
    res %= m;
    return res;
  }
  long long getb(long long l, long long r) {
    long long res = (hr[l] - hr[r + 1] + m) % m;
    res *= ipw[n - r];
    res %= m;
    return res;
  }
  long long ispal(long long l, long long r) {
    long long x = getf(l, r);
    long long y = getb(l, r);
    return (x == y) ? 1 : 0;
  }
  long long ispal(long long l1, long long r1, long long l2, long long r2) {
    long long len1 = r1 - l1 + 1;
    long long len2 = r2 - l2 + 1;
    long long x = getf(l1, r1);
    x += (pw[len1] * getf(l2, r2)) % m;
    x %= m;
    long long y = getb(l2, r2);
    y += (pw[len2] * getb(l1, r1)) % m;
    y %= m;
    return (x == y) ? 1 : 0;
  }
};
unordered_set<long long> st;
unordered_map<string, string> mp;
signed main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  long long n;
  cin >> n;
  string s;
  cin >> s;
  s = '#' + s;
  n++;
  long long m;
  cin >> m;
  long long mx_len = 0;
  while (m--) {
    string second, p;
    cin >> second;
    long long l = (long long)(second.size());
    for (long long i = 0; i < l; i++) {
      if (second[i] >= 'A' && second[i] <= 'Z')
        p += second[i] + 'a' - 'A';
      else
        p += second[i];
    }
    reverse(p.begin(), p.end());
    p = '#' + p;
    mx_len = max(mx_len, l);
    Hash<string> o(p, 199, 1e9 + 7, l + 1);
    long long val = o.getf(1, l);
    st.insert(val);
    mp[p] = second;
  }
  vector<long long> dp(n, -1);
  Hash<string> o(s, 199, 1e9 + 7, n);
  vector<string> ans;
  bool f = 0;
  function<void(long long)> dfs = [&](long long v) {
    if (f) return;
    if (v == n) {
      f = 1;
      long long cur = n - 1;
      while (cur > 0) {
        string z;
        z += '#';
        long long xx = dp[cur];
        for (long long i = xx; i <= cur; i++) z += s[i];
        ans.push_back(mp[z]);
        cur = xx - 1;
      }
      return;
    }
    long long goes = min(v + mx_len, n - 1);
    for (long long i = v; i <= goes; i++) {
      if (f) return;
      if (st.count(o.getf(v, i))) {
        dp[i] = v;
        dfs(i + 1);
      }
    }
    return;
  };
  dfs(1);
  for (long long i = (long long)(ans.size()) - 1; i >= 0; i--)
    cout << ans[i] << ' ';
}