#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
struct node {
  int next[26];
  int num;
  node() {
    num = -1;
    for (int i = 0; i < 26; ++i) next[i] = -1;
  }
};
node t[N * 10 + 1];
int sz = 1;
void add(string& s, int pos) {
  int v = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (t[v].next[s[i] - 'a'] == -1) t[v].next[s[i] - 'a'] = sz++;
    v = t[v].next[s[i] - 'a'];
  }
  t[v].num = pos;
}
void lowerCase(string& s) {
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  }
}
string s[N];
int n, m;
string w;
bool dp[N];
int p[N];
vector<int> ans;
int main() {
  scanf("%d\n", &n);
  cin >> w;
  scanf("%d\n", &m);
  for (int i = 0; i < m; ++i) {
    cin >> s[i];
    string tmp = s[i];
    lowerCase(tmp);
    add(tmp, i);
  }
  dp[0] = true;
  for (int i = 1; i <= n; ++i) {
    int v = 0;
    int j = i - 1;
    bool ok = false;
    while (j >= 0 && t[v].next[w[j] - 'a'] != -1) {
      v = t[v].next[w[j] - 'a'];
      if (t[v].num != -1) {
        ok |= dp[j];
        if (dp[j] == true) p[i] = t[v].num;
      }
      j--;
    }
    dp[i] = ok;
  }
  while (n > 0) {
    ans.push_back(p[n]);
    n -= s[p[n]].size();
  }
  reverse(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); ++i) cout << s[ans[i]] << " ";
  return 0;
}
