#include <bits/stdc++.h>
typedef struct {
  char *key;
  char *val;
  void *next;
} t_hashnode;
t_hashnode *hash_tab[205000];
int str_stack_size[2];
char *str_stack[2][10000];
int len_line, num_words;
int str_len(char *in);
void str_cpy(char *in0, char *in1, int len);
int check_words();
int process_fail();
void push_stack(char *str, int stack_num) {
  if (str_stack_size[stack_num] < 10000) {
    int len = str_len(str);
    str_stack[stack_num][str_stack_size[stack_num]] = new char[len + 1];
    str_cpy(str, str_stack[stack_num][str_stack_size[stack_num]++], len);
  }
}
void pop_stack(char *str, int stack_num) {
  if (str_stack_size[stack_num] > 0) {
    str = str_stack[stack_num][--str_stack_size[stack_num]];
    delete str_stack[stack_num][str_stack_size[stack_num]];
  }
}
void init() {
  for (int i = 0; i < 205000; i++) {
    hash_tab[i] = NULL;
  }
}
int str_len(char *in) {
  int len = 0;
  char *p_in = in;
  while (*p_in++ != '\0') len++;
  return len;
}
int str_cmp(char *in0, char *in1, int len) {
  if (0 == len) {
    while (*in0 == *in1) {
      if (*in0 == '\0' && *in1 == '\0') return true;
      in0++;
      in1++;
    }
    return false;
  } else {
    int i = 0;
    while (*in0++ == *in1++) {
      if (len - 1 == i++) return true;
    }
    return false;
  }
}
void str_cpy(char *in0, char *in1, int len) {
  if (len != 0) {
    for (int i = 0; i < len; i++) {
      *in1++ = *in0++;
    }
    *in1 = '\0';
  } else {
    do {
      *in1++ = *in0;
    } while ('\0' != *in0++);
  }
}
int is_substr(char *str0, char *str1) {
  int len = str_len(str0);
  for (int i = 0; i < len; i++) {
    if (str0[i] != str1[i]) return false;
  }
  if (('\0' == str0[len]) && ('\0' != str1[len]))
    return true;
  else
    return false;
}
void lower_reverse(char *in, char *out) {
  int len;
  len = str_len(in);
  for (int i = 0; i < len; i++) {
    char bar = in[len - 1 - i];
    bar = (bar < 97) ? bar + 32 : bar;
    out[i] = bar;
  }
  out[len] = '\0';
  return;
}
int str_hash(char *str, int len) {
  unsigned int hash_ = 1315423911;
  len = (0 == len) ? str_len(str) : len;
  for (int i = 0; i < len; i++) {
    hash_ ^= ((hash_ << 5) + str[i] + (hash_ >> 2));
  }
  return (hash_ % 205000);
}
void set_value(t_hashnode *node, char *val) { node->val = val; }
int get_value(t_hashnode *node, char *val) {
  val = node->val;
  return 0;
}
int get_key(t_hashnode *node, char *key) {
  key = node->key;
  return 0;
}
void set_next(t_hashnode *node, t_hashnode *next) { node->next = next; }
t_hashnode *get_next(t_hashnode *node) { return (t_hashnode *)node->next; }
char *get_hash_table(char *key, int len) {
  char key_line[1001];
  str_cpy(key, key_line, len);
  int hash_val = str_hash(key_line, 0);
  t_hashnode *node = hash_tab[hash_val];
  while (node != NULL) {
    if (str_cmp(node->key, key_line, 0)) {
      return node->val;
    }
    node = get_next(node);
  }
  return NULL;
}
void put_hash_table(char *key, char *val) {
  int hash_val = str_hash(key, 0);
  t_hashnode *prev = NULL;
  t_hashnode *node = hash_tab[hash_val];
  while (node != NULL && !str_cmp(node->key, key, 0)) {
    prev = node;
    node = get_next(node);
  }
  int len = str_len(key);
  char *node_val = new char[len + 1];
  str_cpy(val, node_val, 0);
  if (NULL != node) {
    delete node->val;
    node->val = node_val;
  } else {
    t_hashnode *node_add = new t_hashnode;
    char *node_key = new char[len + 1];
    str_cpy(key, node_key, 0);
    node_add->key = node_key;
    node_add->val = node_val;
    node_add->next = NULL;
    if (prev == NULL) {
      hash_tab[hash_val] = node_add;
    } else {
      prev->next = node_add;
    }
  }
  return;
}
int process_line(char *line, int idx) {
  if (len_line == idx) {
    for (int i = 0; i < str_stack_size[0]; i++) {
      printf("%s ", str_stack[0][i]);
    }
    return true;
  }
  int size_i = 1;
  do {
    char *bar = NULL;
    int res;
    int i;
    for (i = size_i; i <= 1000; i++) {
      if ((idx + i) > len_line) {
        break;
      }
      bar = get_hash_table(line + idx, i);
      if (NULL != bar) {
        break;
      }
    }
    if (NULL != bar) {
      push_stack(bar, 0);
      res = process_line(line, idx + i);
      if (res) {
        return res;
      } else {
        pop_stack(bar, 0);
        size_i = i + 1;
      }
    } else {
      return false;
    }
  } while (true);
}
int process_fail() {
  char *foo =
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaecaedcddaeadebdbaddbdecaea"
      "cccdeedabdbdadabbcdabddbabdbbacbcbeaaabeedbbecacecbcdbceccaecdeacddddaee"
      "ddeebebaeddbbacededbdbdecedabdbaceedddeeaecccbcacddaadeaaaccdbaeddaebcea"
      "acacaca";
  if (is_substr(foo, str_stack[0][0])) {
    printf("Failed ");
    int sum = 0;
    for (int i = 0; i < str_stack_size[0]; i++) {
      sum += str_len(str_stack[0][i]);
      printf("%d ", str_len(str_stack[0][i]));
    }
    printf("%d %d ", str_stack_size[0], sum);
    printf("debug stack: ");
    for (int i = 0; i < str_stack_size[1]; i++) {
      printf("%s ", str_stack[1][i]);
    }
  }
  return false;
}
int main(int argc, char **argv) {
  init();
  char line_cyphered[10001];
  char word_in[1001], word_reversed[1001];
  scanf("%d", &len_line);
  scanf("%s", line_cyphered);
  scanf("%d", &num_words);
  for (int i = 0; i < num_words; i++) {
    scanf("%s", word_in);
    lower_reverse(word_in, word_reversed);
    put_hash_table(word_reversed, word_in);
  }
  process_line(line_cyphered, 0);
  return 0;
}
