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 gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * (b / (gcd(a, b))); }
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
inline long long toLL(string s) {
  long long v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
using namespace std;
string mains;
int n;
unordered_map<long long, string> ma;
bool seen[10000 + 1];
bool memo[10000 + 1];
vector<string> ans;
const int A = 1e4 + 100, BASE = 1e6 + 3, MOD = 98765431;
int m;
inline bool solve(int s) {
  if (s == n) return 1;
  if (seen[s] == 1) return memo[s];
  seen[s] = 1;
  bool c = 0;
  long long hash = 0;
  for (int i = s; i < n; i++) {
    hash = hash * BASE + mains[i];
    if (ma.find(hash) != ma.end()) {
      c |= solve(i + 1);
    }
  }
  return memo[s] = c;
}
inline void trace(int s) {
  if (s == n) return;
  long long hash = 0;
  for (int i = s; i < n; i++) {
    hash = hash * BASE + mains[i];
    if (ma.count(hash)) {
      if (solve(i + 1) == 1) {
        ans.push_back(ma[hash]);
        trace(i + 1);
        return;
      }
    }
  }
  return;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  memset(seen, 0, sizeof(seen));
  memset(memo, 0, sizeof(memo));
  cin >> n;
  cin >> mains;
  string sub;
  string ne = "";
  cin >> m;
  for (int i = 0; i < (int)m; i++) {
    cin >> sub;
    string ne = "";
    int sz = (int)(sub.size());
    for (int j = 0; j < (int)sz; j++) ne = ne + sub[j];
    long long hash = 0;
    for (int j = 0; j < (int)sz; j++) ne[j] = tolower(ne[j]);
    for (int j = 0; j < sz; j++) hash = hash * BASE + ne[j];
    ma[hash] = sub;
  }
  reverse(mains.begin(), mains.end());
  solve(0);
  trace(0);
  int sz = ((int)((ans).size()));
  for (int i = sz - 1; i >= 0; i--) cout << ans[i] << " ";
}