#include <bits/stdc++.h>
using namespace std;
const long long base = 31LL;
map<long long, string> mp;
string s, w;
int n, m;
long long a[1000010];
inline void print(int p) {
  if (!p) return;
  string tmp = mp[a[p]];
  print(p - tmp.size());
  cout << tmp << " ";
}
int main() {
  cin >> n >> s >> m;
  for (int i = 1; i <= m; ++i) {
    string w;
    cin >> w;
    long long now = 0;
    for (int j = 0; j < w.size(); ++j) now = now * base + 1LL * tolower(w[j]);
    mp[now] = w;
  }
  memset(a, -1, sizeof(a));
  a[0] = 0;
  for (int i = 0; i < n; ++i) {
    long long now = 0;
    for (int j = i; j >= 0; --j) {
      now = now * base + 1LL * tolower(s[j]);
      if (a[j] != -1 && mp.find(now) != mp.end()) {
        a[i + 1] = now;
        break;
      }
    }
  }
  print(n);
  return 0;
}
