#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,m,k,x;
ll v[501];
string s,a[505];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    if(fopen("FWORD.INP","r")){
        freopen("FWORD.INP","r",stdin);
        freopen("FWORD.OUT","w",stdout);
    }
    cin >> n >> m >> k >> x;
    cin >> s;
    ll i,j;
    for(ll i=1;i<=m;i++){
        cin >> a[i];
        sort(a[i].begin(),a[i].end());
    }
    x--; i=m;
    while(x>0){
        v[i] = x%k;
        x/=k;
        i--;
    }
    i=0;
    for(j=0;j<s.size();j++){
        if(s[j]=='#'){
            i++;
            s[j] = a[i][v[i]];
        }
    }
    cout << s;
}
