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