#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <algorithm>
using namespace std;
string t;
int n,m;
set <string> words;
map <string, string> mymap;
stack <string> ans;
int mz = 0;
string lower(string s){
int len = s.size();
for(int i = 0; i<len; i++){
if(s[i]<'a') s[i] = s[i] - 'A' + 'a';
}
return s;
}
bool sol(string s){
if(s=="") return true;
string z = "";
int len = s.size();
for(int i = 0; i<min(mz,len); i++){
z += s[i];
if(words.find(z)!=words.end()){
ans.push(z);
if(sol(s.substr(i+1,len-i))){
while(!ans.empty()){
cout<<mymap[ans.top()]<<" ";
ans.pop();
}
break;
}
}
}
if(!ans.empty()) ans.pop();
return false;
}
int main(){
cin>>n;
cin>>t;
cin>>m;
string tmp,tmp2;
for(int i = 0; i<m; i++){
cin>>tmp;
tmp2 = lower(tmp);
words.insert(tmp2);
mymap[tmp2] = tmp;
mz = max(mz,(int)tmp.size());
}
reverse(t.begin(),t.end());
sol(t);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c2V0PgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8c3RhY2s+CiNpbmNsdWRlIDxhbGdvcml0aG0+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RyaW5nIHQ7CmludCBuLG07CnNldCA8c3RyaW5nPiB3b3JkczsKbWFwIDxzdHJpbmcsIHN0cmluZz4gbXltYXA7CgpzdGFjayA8c3RyaW5nPiBhbnM7CmludCBteiA9IDA7CgpzdHJpbmcgbG93ZXIoc3RyaW5nIHMpewogICAgaW50IGxlbiA9IHMuc2l6ZSgpOwogICAgZm9yKGludCBpID0gMDsgaTxsZW47IGkrKyl7CiAgICAgICAgaWYoc1tpXTwnYScpIHNbaV0gPSBzW2ldIC0gJ0EnICsgJ2EnOwogICAgfQogICAgcmV0dXJuIHM7Cn0KCmJvb2wgc29sKHN0cmluZyBzKXsKICAgIGlmKHM9PSIiKSByZXR1cm4gdHJ1ZTsKICAgIHN0cmluZyB6ID0gIiI7CiAgICBpbnQgbGVuID0gcy5zaXplKCk7CiAgICBmb3IoaW50IGkgPSAwOyBpPG1pbihteixsZW4pOyBpKyspewogICAgICAgIHogKz0gc1tpXTsKICAgICAgICBpZih3b3Jkcy5maW5kKHopIT13b3Jkcy5lbmQoKSl7CiAgICAgICAgICAgIGFucy5wdXNoKHopOwogICAgICAgICAgICBpZihzb2wocy5zdWJzdHIoaSsxLGxlbi1pKSkpewogICAgICAgICAgICAgICAgd2hpbGUoIWFucy5lbXB0eSgpKXsKICAgICAgICAgICAgICAgICAgICBjb3V0PDxteW1hcFthbnMudG9wKCldPDwiICI7CiAgICAgICAgICAgICAgICAgICAgYW5zLnBvcCgpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBpZighYW5zLmVtcHR5KCkpIGFucy5wb3AoKTsKICAgIHJldHVybiBmYWxzZTsKfQoKaW50IG1haW4oKXsKICAgIGNpbj4+bjsKICAgIGNpbj4+dDsKICAgIGNpbj4+bTsKICAgIHN0cmluZyB0bXAsdG1wMjsKICAgIGZvcihpbnQgaSA9IDA7IGk8bTsgaSsrKXsKICAgICAgICBjaW4+PnRtcDsKICAgICAgICB0bXAyID0gbG93ZXIodG1wKTsKICAgICAgICB3b3Jkcy5pbnNlcnQodG1wMik7CiAgICAgICAgbXltYXBbdG1wMl0gPSB0bXA7CiAgICAgICAgbXogPSBtYXgobXosKGludCl0bXAuc2l6ZSgpKTsKICAgIH0KICAgIHJldmVyc2UodC5iZWdpbigpLHQuZW5kKCkpOwogICAgc29sKHQpOwogICAgcmV0dXJuIDA7Cn0=