#include <bits/stdc++.h>
using namespace std;
int trie[1000005][26], e[1000005], st[1000005], tot;
bool dp[1000005];
string str, ch[1000005];
pair<int, int> pre[1000005];
void ins(string s, int pos) {
  int len = s.size(), p = 0;
  for (int i = len - 1; i >= 0; i--) {
    if (s[i] >= 'A' && s[i] <= 'Z') s[i] += 32;
    if (!trie[p][s[i] - 'a']) trie[p][s[i] - 'a'] = ++tot;
    p = trie[p][s[i] - 'a'];
  }
  e[p] = pos;
}
int main() {
  int n, m;
  cin >> n >> str >> m;
  for (int i = 1; i <= m; i++) {
    cin >> ch[i];
    ins(ch[i], i);
  }
  for (int i = 0; i < n; i++) {
    if (i == 0 || dp[i - 1] == 1) {
      int p = 0;
      for (int j = i; j < n; j++) {
        if (!trie[p][str[j] - 'a']) break;
        p = trie[p][str[j] - 'a'];
        if (e[p]) {
          dp[j] = 1;
          pre[j] = make_pair(i - 1, e[p]);
        }
      }
    }
  }
  int y = n - 1, top = 0;
  while (y >= 0) {
    st[++top] = pre[y].second;
    y = pre[y].first;
  }
  for (int i = top; i >= 0; i--) cout << ch[st[i]] << " ";
}
