#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;
}
