#include <bits/stdc++.h>
using namespace std;
int n, m, cur, ch;
int cntNodes = 1;
int trie[1001000][26];
int DP[1001000];
int isWord[1001000];
string str, auxStr;
vector<string> words;
void insert(string str, int idx) {
  cur = 1;
  for (int i = 0; i < str.length(); i++) {
    ch = (str[i] >= 'a') ? str[i] - 'a' : str[i] - 'A';
    if (!trie[cur][ch]) trie[cur][ch] = ++cntNodes;
    cur = trie[cur][ch];
  }
  isWord[cur] = idx;
}
void printAns(int i) {
  if (i == 0) return;
  printAns(i - words[DP[i] - 1].length());
  cout << words[DP[i] - 1] << " ";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  cin >> str;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> auxStr;
    words.push_back(auxStr);
    insert(auxStr, i + 1);
  }
  DP[0] = -1;
  for (int i = 1; i <= n; i++) {
    cur = 1;
    for (int j = i - 1; j >= 0; j--) {
      ch = str[j] - 'a';
      if (!trie[cur][ch]) break;
      cur = trie[cur][ch];
      if (DP[j] && isWord[cur]) {
        DP[i] = isWord[cur];
        break;
      }
    }
  }
  printAns(n);
  cout << endl;
  return 0;
}
