#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  string s;
  cin >> s;
  cin >> m;
  vector<string> v(m);
  for (long long i = 0; i < m; i++) cin >> v[i];
  vector<string> copy_v = v;
  map<string, int> M[1005];
  int max_size = 0;
  for (long long i = 0; i < m; i++) {
    for (long long j = 0; j < v[i].size(); j++) {
      if (v[i][j] >= 'A' && v[i][j] <= 'Z') v[i][j] -= ('A' - 'a');
    }
    reverse(v[i].begin(), v[i].end());
    max_size = max(max_size, int(v[i].size()));
    M[v[i].size()][v[i]] = i;
  }
  vector<long long> DP(n + 1, -1);
  DP[0] = -2;
  for (long long i = 0; i < n; i++) {
    if (DP[i] == -1) continue;
    string st = "";
    for (int j = i; j < n; ++j) {
      st += s[j];
      if (int(st.size()) > max_size) break;
      map<string, int>::iterator it = M[st.size()].find(st);
      if (it != M[st.size()].end()) {
        DP[j + 1] = (*it).second;
      }
    }
  }
  vector<string> sol;
  int pos = n;
  while (DP[pos] != -2) {
    sol.push_back(copy_v[DP[pos]]);
    pos -= int(v[DP[pos]].size());
  }
  reverse(sol.begin(), sol.end());
  for (long long i = 0; i < sol.size(); i++) cout << sol[i] << ' ';
  cout << endl;
}
