#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;
}