#include <bits/stdc++.h>
using namespace std;
int Next[1100000][26], bo[1100000], tot, n, m, f[1100000], pos[1100000];
char c[1100000];
string s[110000];
void add(string &s, int val) {
  int len = s.length(), p = 1;
  for (int i = 0; i < len; ++i) {
    char c = s[i];
    int j;
    if (c >= 'a' && c <= 'z')
      j = c - 'a';
    else
      j = c - 'A';
    if (!Next[p][j]) Next[p][j] = ++tot;
    p = Next[p][j];
  }
  bo[p] = val;
}
int main() {
  scanf("%d%s", &n, c + 1);
  scanf("%d", &m);
  tot = 1;
  for (int i = (1); i <= (m); ++i) {
    cin >> s[i];
    reverse(s[i].begin(), s[i].end());
    add(s[i], i);
  }
  f[0] = 1;
  for (int i = 0; i < n; ++i)
    if (f[i]) {
      int p = 1;
      for (int j = i + 1; j <= n && j - i <= 1010; ++j) {
        int v = c[j] - 'a';
        if (!Next[p][v]) break;
        p = Next[p][v];
        if (bo[p]) {
          f[j] = 1;
          pos[j] = bo[p];
        }
      }
    }
  vector<int> ans;
  for (int i = n; i != 0; i -= s[pos[i]].length()) {
    ans.push_back(pos[i]);
  }
  for (int i = (1); i <= (m); ++i) reverse(s[i].begin(), s[i].end());
  for (int i = ans.size() - 1; i >= 0; --i) {
    cout << s[ans[i]] << ' ';
  }
  return 0;
}
