#include <bits/stdc++.h>
using namespace std;
const long long p = 29;
long long seq[100100];
map<long long, string> hs;
string s;
void print(int n) {
  if (!n) return;
  string t = hs[seq[n]];
  print(n - t.size());
  cout << t << " ";
}
int main() {
  int n, m;
  cin >> n >> s >> m;
  for (int i = 0; i < m; i++) {
    string a;
    cin >> a;
    long long h = 0;
    for (int j = 0; j < a.size(); j++) {
      h = h * p + tolower(a[j]);
    }
    hs[h] = a;
  }
  fill(seq, seq + n, -1);
  seq[0] = 0;
  for (int i = 0; i < n; i++) {
    long long h = 0;
    for (int j = i; j >= 0; j--) {
      h = h * p + s[j];
      if (seq[j] != -1 && hs.count(h)) {
        seq[i + 1] = h;
        break;
      }
    }
  }
  print(n);
}
