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;
struct RollingHash {
  static const signed long long mo0 = 1000000007, mo1 = 1000000009;
  static signed long long mul0, mul1;
  static const signed long long add0 = 1000010007, add1 = 1003333331;
  static vector<signed long long> pmo[2];
  string s;
  int l;
  vector<signed long long> hash_[2];
  void init(string s) {
    this->s = s;
    l = s.size();
    int i, j;
    hash_[0] = hash_[1] = vector<signed long long>(1, 0);
    if (!mul0)
      mul0 = 10009 + (((signed long long)&mul0) >> 5) % 259,
      mul1 = 10007 + (((signed long long)&mul1) >> 5) % 257;
    if (pmo[0].empty()) pmo[0].push_back(1), pmo[1].push_back(1);
    for (i = 0; i < (l); i++)
      hash_[0].push_back((hash_[0].back() * mul0 + add0 + s[i]) % mo0);
    for (i = 0; i < (l); i++)
      hash_[1].push_back((hash_[1].back() * mul1 + add1 + s[i]) % mo1);
  }
  pair<signed long long, signed long long> hash(int l, int r) {
    if (l > r) return make_pair(0, 0);
    while (pmo[0].size() < r + 2)
      pmo[0].push_back(pmo[0].back() * mul0 % mo0),
          pmo[1].push_back(pmo[1].back() * mul1 % mo1);
    return make_pair(
        (hash_[0][r + 1] + (mo0 - hash_[0][l] * pmo[0][r + 1 - l] % mo0)) % mo0,
        (hash_[1][r + 1] + (mo1 - hash_[1][l] * pmo[1][r + 1 - l] % mo1)) %
            mo1);
  }
  pair<signed long long, signed long long> hash(string s) {
    init(s);
    return hash(0, s.size() - 1);
  }
  static pair<signed long long, signed long long> concat(
      pair<signed long long, signed long long> L,
      pair<signed long long, signed long long> R, int RL) {
    while (pmo[0].size() < RL + 2)
      pmo[0].push_back(pmo[0].back() * mul0 % mo0),
          pmo[1].push_back(pmo[1].back() * mul1 % mo1);
    return make_pair((R.first + L.first * pmo[0][RL]) % mo0,
                     (R.second + L.second * pmo[1][RL]) % mo1);
  }
};
vector<signed long long> RollingHash::pmo[2];
signed long long RollingHash::mul0, RollingHash::mul1;
int N, M;
string S;
string W[100000];
unordered_map<signed long long, int> L[1010];
RollingHash rh;
int from[10100];
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N >> S;
  rh.init(S);
  cin >> M;
  for (i = 0; i < (M); i++) {
    cin >> W[i];
    s = W[i];
    reverse((s.begin()), (s.end()));
    for (auto& r : s) r = tolower(r);
    RollingHash rh2;
    auto r = rh2.hash(s);
    L[s.size()][(r.first << 30) | r.second] = i;
  }
  memset(from, 0xff, sizeof(from));
  from[0] = 0;
  for (i = 0; i < (N); i++)
    if (from[i] >= 0) {
      for (x = 1; x <= 1000 && i + x <= N; x++) {
        auto r = rh.hash(i, i + x - 1);
        signed long long v = (r.first << 30) | r.second;
        if (L[x].count(v)) {
          from[i + x] = L[x][v];
        }
      }
    }
  x = N;
  vector<string> SS;
  while (x) {
    SS.push_back(W[from[x]]);
    x = x - W[from[x]].size();
  }
  reverse((SS.begin()), (SS.end()));
  for (auto& r : SS) cout << r << " ";
  cout << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  solve();
  return 0;
}