#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 5;
const unsigned long long b1 = 131, b2 = 37;
int n, m, mx, rea[N], cnt;
string s, t, pre[N], ans[N];
set<pair<unsigned long long, unsigned long long> > z;
pair<unsigned long long, unsigned long long> has(string q) {
  unsigned long long a = 0, b = 0;
  for (int i = 0; i < q.size(); i++) {
    if (q[i] < 'a') q[i] += 32;
    a = a * b1 + q[i], b = b * b2 + q[i];
  }
  return make_pair(a, b);
}
map<pair<unsigned long long, unsigned long long>, string> q;
int main() {
  cin >> n >> s >> m;
  reverse(s.begin(), s.end());
  for (int i = 1; i <= m; i++)
    cin >> t, q[has(t)] = t, mx = max(mx, (int)t.size());
  for (int i = 0; i < n; i++) {
    if (i > 0 && !rea[i]) continue;
    unsigned long long a = 0, b = 0;
    int r = min(n, i + mx);
    for (int j = i + 1; j <= r; j++) {
      a = a * b1 + s[j - 1], b = b * b2 + s[j - 1];
      if (q.find(make_pair(a, b)) != q.end()) {
        rea[j] = 1;
        pre[j] = q[make_pair(a, b)];
      }
    }
  }
  int pos = n;
  while (pos != 0) {
    ans[++cnt] = pre[pos];
    pos = pos - pre[pos].size();
  }
  for (int i = 1; i <= cnt; i++) cout << ans[i] << " ";
  return 0;
}
