#include <bits/stdc++.h>
using namespace std;
struct Trie {
  int endWhat = {0};
  Trie* next[26] = {NULL};
  Trie* getTrie(char x) {
    int num;
    if (x >= 'A' && x <= 'Z')
      num = x - 'A';
    else if (x >= 'a' && x <= 'z')
      num = x - 'a';
    if (next[num] == NULL) next[num] = new Trie();
    return next[num];
  }
  bool exists(char x) {
    int num;
    if (x >= 'A' && x <= 'Z')
      num = x - 'A';
    else if (x >= 'a' && x <= 'z')
      num = x - 'a';
    return (next[num] != NULL);
  }
};
Trie* head = new Trie();
int dp[10011];
string words[100111];
int wordAt[10011];
char s[10011];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  int m;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    cin >> words[i];
    Trie* curr = head;
    int len = words[i].size();
    for (int j = len - 1; j >= 0; j--) {
      curr = curr->getTrie(words[i][j]);
    }
    curr->endWhat = i;
  }
  int slen = strlen(s);
  dp[slen] = INT_MAX;
  for (int i = slen - 1; i >= 0; i--) {
    int max_check = min(slen - 1, i + 1001);
    Trie* curr = head;
    for (int j = i; j <= max_check; j++) {
      if (curr->exists(s[j]) == false) break;
      curr = curr->getTrie(s[j]);
      if (curr->endWhat && dp[j + 1]) {
        dp[i] = j + 1;
        wordAt[i] = curr->endWhat;
        break;
      }
    }
  }
  assert(dp[0]);
  int start = 0;
  while (start != slen) {
    cout << words[wordAt[start]] << " ";
    start = dp[start];
  }
  return 0;
}
