Problem: After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After many weeks of observation of Siddhant’s sentences, Yash determined a new cipher technique.

For a given sentence, the cipher is processed as: 

  1. Convert all letters of the sentence to lowercase. 
  2. Reverse each of the words of the sentence individually. 
  3. Remove all the spaces in the sentence. 



For example, when this cipher is applied to the sentence

Kira is childish and he hates losing

the resulting string is

ariksihsidlihcdnaehsetahgnisol

Now Yash is given some ciphered string and a list of words. Help him to find out any original sentence composed using only words from the list. Note, that any of the given words could be used in the sentence multiple times.

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 10 000) — the length of the ciphered text. The second line consists of n lowercase English letters — the ciphered text t.

The third line contains a single integer m (1 ≤ m ≤ 100 000) — the number of words which will be considered while deciphering the text. Each of the next m lines contains a non-empty word wi (|wi| ≤ 1 000) consisting of uppercase and lowercase English letters only. It's guaranteed that the total length of all words doesn't exceed 1 000 000.

Output

Print one line — the original sentence. It is guaranteed that at least one solution exists. If there are multiple solutions, you may output any of those.

Examples

Input

30
ariksihsidlihcdnaehsetahgnisol
10
Kira
hates
is
he
losing
death
childish
L
and
Note


Output

Kira is childish and he hates losing 


Input

12
iherehtolleh
5
HI
Ho
there
HeLLo
hello


Output

HI there HeLLo 

Note

In sample case 2 there may be multiple accepted outputs, "HI there HeLLo" and "HI there hello" you may output any of them. 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
map<string, string> mp;
int k = 0;
int c = 0;
typedef struct Trie {
  Trie *next[26];
  int sum;
};
Trie *root;
void init() {
  root = new Trie;
  for (int i = 0; i < 26; i++) {
    root->next[i] = NULL;
  }
}
void createTrie(string num) {
  int len = num.length();
  Trie *p = root;
  for (int i = 0; i < len; i++) {
    int id = (int)(num[i] - 'a');
    if (p->next[id] == NULL) {
      p->next[id] = new Trie;
      p = p->next[id];
      p->sum = 0;
      for (int j = 0; j < 26; j++) {
        p->next[j] = NULL;
      }
    } else {
      p = p->next[id];
    }
  }
  p->sum = 1;
}
bool fin2(char *str, int h) {
  int len = strlen(str);
  Trie *p = root;
  for (int i = h; i < len; i++) {
    int id = (int)(str[i] - 'a');
    if (p->next[id] != NULL) {
      p = p->next[id];
      if (p->sum == 1) return true;
    } else
      return false;
  }
  return false;
}
void fin(char str[], int h) {
  int len = strlen(str);
  Trie *p = root;
  string stt;
  for (int i = h; i < len; i++) {
    int id = (int)(str[i] - 'a');
    if (p->next[id] != NULL) {
      p = p->next[id];
      stt += id + 'a';
      k++;
    } else
      break;
  }
  if (fin2(str, k) || k == len)
    cout << mp[stt];
  else {
    Trie *p = root;
    stt.clear();
    int i;
    for (i = h; i < k - 1; i++) {
      int id = (int)(str[i] - 'a');
      if (p->next[id] != NULL) {
        p = p->next[id];
        stt += id + 'a';
        if (p->sum == 1 && fin2(str, i + 1)) {
          k = i + 1;
          break;
        }
      } else
        break;
    }
    cout << mp[stt];
  }
}
int main() {
  int n, t;
  init();
  char ss[10005];
  scanf("%d", &n);
  scanf("%s", ss);
  scanf("%d", &t);
  string nu;
  char s[1005];
  for (int i = 0; i < t; i++) {
    nu.clear();
    scanf("%s", s);
    for (int j = strlen(s) - 1; j >= 0; j--) {
      if (s[j] >= 'A' && s[j] <= 'Z') {
        nu += s[j] + 32;
      } else {
        nu += s[j];
      }
    }
    createTrie(nu);
    mp[nu] = s;
  }
  while (k < n) {
    if (c == 1) {
      printf(" ");
    }
    fin(ss, k);
    c = 1;
  }
  printf("\n");
}