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;
inline int nextint() {
  int x;
  scanf("%d", &x);
  return x;
}
inline long long nextll() {
  long long x;
  scanf("%lld", &x);
  return x;
}
template <typename T>
void scanint(T& x) {
  T c = getchar();
  while (((c < 48) || (c > 57)) && (c != '-')) c = getchar();
  bool neg = false;
  if (c == '-') neg = true;
  x = 0;
  for (; c < 48 || c > 57; c = getchar())
    ;
  for (; c > 47 && c < 58; c = getchar()) x = (x * 10) + (c - 48);
  if (neg) x = -x;
}
template <typename T>
T min_(T a, T b) {
  return a > b ? b : a;
}
template <typename T, typename... Ts>
T min_(T first, Ts... last) {
  return min_(first, min_(last...));
}
template <class T, class S>
std::ostream& operator<<(std::ostream& os, const std::pair<T, S>& t) {
  os << "(" << t.first << ", " << t.second << ")";
  return os;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last) out << ", ";
  }
  out << "]";
  return out;
}
long long pwr(long long base, long long p, long long mod) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % mod;
    base = (base * base) % mod;
    p /= 2;
  }
  return ans;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
const long double PI = (long double)(3.1415926535897932384626433832795);
const long long mx_ll = numeric_limits<long long>::max();
const int mx_int = numeric_limits<int>::max();
const int mod = 1e9 + 7;
const int maxn = 1e6 + 7;
const int maxchar = 27;
int trie[maxn][maxchar], word_ending_id[maxn];
int sz = 1;
inline void insert(string str, int id) {
  int len = str.length();
  int node = 0;
  for (int i = len - 1; i >= 0; i--) {
    int ch;
    if (str[i] >= 'a' && str[i] <= 'z')
      ch = str[i] - 'a';
    else
      ch = str[i] - 'A';
    if (trie[node][ch] == -1) trie[node][ch] = sz++;
    node = trie[node][ch];
  }
  word_ending_id[node] = id;
}
vector<int> ans;
int dp[maxn];
string inp;
int n;
inline int query(int id) {
  int node = 0;
  for (int i = id; i < n; i++) {
    int ch = inp[i] - 'a';
    if (trie[node][ch] == -1) return -1;
    node = trie[node][ch];
    if (word_ending_id[node] != -1 && dp[i + 1] != -1) {
      return word_ending_id[node];
    }
  }
  return -1;
}
int main() {
  memset(trie, -1, sizeof(trie));
  memset(word_ending_id, -1, sizeof(word_ending_id));
  memset(dp, -1, sizeof(dp));
  scanint(n);
  cin >> inp;
  int t;
  scanint(t);
  vector<string> sos(maxn);
  for (int i = 1; i <= t; i++) {
    string x;
    cin >> x;
    sos[i] = x;
    insert(x, i);
  }
  dp[n] = 0;
  for (int i = n - 1; i >= 0; i--) dp[i] = query(i);
  int i = 0;
  while (i < n) {
    cout << sos[dp[i]] << " ";
    i += sos[dp[i]].length();
  }
  return 0;
}