#include <bits/stdc++.h>
using namespace std;
const int Max = 1e6 + 10;
const int MaxM = 10010;
typedef struct node {
  int next[30];
  int mark;
} Tree;
Tree Tr[Max];
int top;
char str[Max];
char s[MaxM * 10][1011];
int n, m;
int vis[MaxM];
bool flag;
int NewNode() {
  for (int i = 0; i <= 26; i++) {
    Tr[top].next[i] = -1;
  }
  Tr[top].mark = -1;
  return top++;
}
int ok(char c) {
  if (c >= 'a' && c <= 'z') {
    return c - 'a';
  } else {
    return c - 'A';
  }
}
void Build(int Root, int index) {
  int len = strlen(s[index]);
  for (int i = 0; i < len; i++) {
    int ans = ok(s[index][i]);
    if (Tr[Root].next[ans] == -1) {
      Tr[Root].next[ans] = NewNode();
    }
    Root = Tr[Root].next[ans];
  }
  Tr[Root].mark = index;
}
int DFS(int pos) {
  if (pos == -1) {
    return true;
  }
  if (vis[pos] != -1) {
    return vis[pos];
  }
  int Root = 0;
  for (int i = pos; i >= 0; i--) {
    int ans = ok(str[i]);
    if (Tr[Root].next[ans] == -1) {
      break;
    }
    Root = Tr[Root].next[ans];
    if (Tr[Root].mark != -1 && DFS(i - 1)) {
      if (flag)
        printf(" ");
      else
        flag = true;
      printf("%s", s[Tr[Root].mark]);
      return vis[pos] = 1;
    }
  }
  return vis[pos] = 0;
}
int main() {
  scanf("%d", &n);
  scanf("%s", str);
  scanf("%d", &m);
  top = 0;
  flag = false;
  int Root = NewNode();
  for (int i = 0; i < m; i++) {
    scanf("%s", s[i]);
    Build(Root, i);
  }
  for (int i = 0; i < MaxM; i++) {
    vis[i] = -1;
  }
  DFS(n - 1);
  return 0;
}
