#include <bits/stdc++.h>
using namespace std;
const int bas = 131;
const int N = 1e5 + 5;
int n, m;
string ss, s;
map<unsigned long long, string> mp;
unsigned long long dp[N];
vector<string> e;
int main() {
  scanf("%d", &n);
  cin >> ss;
  ss = " " + ss;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    cin >> s;
    string kk = s;
    for (int j = 0; j < s.size(); j++)
      if (s[j] <= 96) s[j] += 32;
    reverse(s.begin(), s.end());
    unsigned long long g = 0;
    for (int j = 0; j < s.size(); j++) g = g * bas + s[j] - 96;
    mp[g] = kk;
  }
  dp[n + 1] = 1;
  for (int i = n; i > 0; i--) {
    unsigned long long g = 0;
    for (int j = i; j <= n; j++) {
      g = g * bas + ss[j] - 96;
      if (dp[j + 1] && mp.count(g)) {
        dp[i] = g;
        break;
      }
    }
  }
  for (int i = 1; i <= n; i += (int)(mp[dp[i]].size()))
    cout << mp[dp[i]] << " ";
  return 0;
}
