#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 1;
const int M = 1e5 + 1;
const int L = 1e3 + 1;
const int P = 239017;
char a[N];
char words[M][L];
set<unsigned long long> w;
map<unsigned long long, string> inf;
map<string, string> was;
struct {
  int prev;
  string val;
} dp[N];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", a);
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%s", words[i]);
    int len = strlen(words[i]);
    string p = string(words[i]);
    for (int j = 0; j < len; j++) {
      words[i][j] = tolower(words[i][j]);
    }
    reverse(words[i], words[i] + len);
    unsigned long long h = 0;
    for (int j = 0; j < len; j++) {
      h = h * P + words[i][j];
    }
    w.insert(h);
    inf[h] = string(words[i]);
    was[inf[h]] = p;
  }
  for (int i = 0; i < n; i++) {
    dp[i].prev = -1;
  }
  for (int i = 0; i < n; i++) {
    if (i == 0 || dp[i - 1].prev != -1) {
      unsigned long long h = 0;
      for (int j = 0; j <= 1000 && i + j < n; j++) {
        h = h * P + a[i + j];
        if (w.count(h) != 0) {
          dp[i + j].prev = i;
          dp[i + j].val = inf[h];
        }
      }
    }
  }
  vector<string> ans;
  int cur = n - 1;
  while (cur != -1) {
    ans.push_back(was[dp[cur].val]);
    cur = dp[cur].prev - 1;
  }
  reverse(ans.begin(), ans.end());
  for (auto i : ans) {
    printf("%s ", i.c_str());
  }
  return 0;
}
