#include <bits/stdc++.h>
using namespace std;
int n, m, k, x;
string s, p[501];
int v[501] = {};
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie();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;
    int i, j;
    for (i = 1; i <= m; i++)
    {
        cin >> p[i];
        sort(p[i].begin(), p[i].end());
    }
    x--;
    i = m;
    while (x > 0)
    {
        v[i] = x % k;
        x /= k;
        i--;
    }
    i = 0;
    for (j = 0; j < s.length(); j++)
        if (s[j] == '#')
        {
            i++;
            s[j] = p[i][v[i]];
        }
    cout << s;
}
