#include <bits/stdc++.h>
using namespace std;
template <typename T, typename T1>
ostream &operator<<(ostream &out, pair<T, T1> obj) {
  out << "(" << obj.first << "," << obj.second << ")";
  return out;
}
template <typename T, typename T1>
ostream &operator<<(ostream &out, map<T, T1> cont) {
  typename map<T, T1>::const_iterator itr = cont.begin();
  typename map<T, T1>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, set<T> cont) {
  typename set<T>::const_iterator itr = cont.begin();
  typename set<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, multiset<T> cont) {
  typename multiset<T>::const_iterator itr = cont.begin();
  typename multiset<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
  return out;
}
template <typename T,
          template <typename ELEM, typename ALLOC = allocator<ELEM>> class CONT>
ostream &operator<<(ostream &out, CONT<T> cont) {
  typename CONT<T>::const_iterator itr = cont.begin();
  typename CONT<T>::const_iterator ends = cont.end();
  for (; itr != ends; ++itr) out << *itr << " ";
  out << endl;
  return out;
}
template <typename T, unsigned int N, typename CTy, typename CTr>
typename enable_if<!is_same<T, char>::value, basic_ostream<CTy, CTr> &>::type
operator<<(basic_ostream<CTy, CTr> &out, const T (&arr)[N]) {
  for (auto i = 0; i < N; ++i) out << arr[i] << " ";
  out << endl;
  return out;
}
template <typename T>
T gcd(T a, T b) {
  T min_v = min(a, b);
  T max_v = max(a, b);
  while (min_v) {
    T temp = max_v % min_v;
    max_v = min_v;
    min_v = temp;
  }
  return max_v;
}
template <typename T>
T lcm(T a, T b) {
  return (a * b) / gcd(a, b);
}
template <typename T>
T fast_exp_pow(T base, T exp, T mod) {
  long long res = 1;
  while (exp) {
    if (exp & 1) {
      res *= base;
      res %= mod;
    }
    exp >>= 1;
    base *= base;
    base %= mod;
  }
  return res;
}
int N, M, L, pos_wrd, pos_set;
long long rev_hash, hashs;
vector<string> words;
stack<string> result;
map<int, pair<int, int>> visited;
map<long long, int> keep_hashes;
string setence, wrd;
long long get_hash(const string &wrd) {
  long long res = 0;
  for (auto val : wrd)
    res = (res * 257 + (tolower(val) - 'a') + 1) % 1000000007;
  return res;
}
int main() {
  scanf("%d", &N);
  cin >> setence;
  scanf("%d", &M);
  for (auto i = 0; i < M; ++i) {
    cin >> wrd;
    reverse(wrd.begin(), wrd.end());
    rev_hash = get_hash(wrd);
    keep_hashes[rev_hash] = i;
    reverse(wrd.begin(), wrd.end());
    words.push_back(wrd);
    L = max(L, (int)wrd.size());
  }
  visited[0] = make_pair(-1, 0);
  for (auto i = 1; i <= N; ++i)
    if (visited.count(i - 1)) {
      hashs = 0;
      for (auto j = 1; j <= L; ++j) {
        if (i + j - 2 >= N) break;
        hashs = (hashs * 257 + (setence[i + j - 2] - 'a') + 1) % 1000000007;
        if (keep_hashes.count(hashs))
          visited[i + j - 1] = make_pair(keep_hashes[hashs], i - 1);
      }
    }
  pos_set = N;
  while (pos_set) {
    pos_wrd = visited[pos_set].first;
    result.push(words[pos_wrd]);
    pos_set = visited[pos_set].second;
  }
  while (!result.empty()) {
    cout << result.top() << " ";
    result.pop();
  }
  return 0;
}
