import java.util.*;
import java.io.*;
class Ideone
{
public static void main
(String args
[]) {
Scanner in
= new Scanner
(System.
in);
short Lwidth = in.nextShort(), Lheight = in.nextShort();
if (in.hasNextLine())
{
in.nextLine();
}
for (short h = 0; h < Lheight; ++h)
{
String alphabet_line
= in.
nextLine(); short i = 0;
for(char sym = 'a', Sym = 'A'; sym <= 'z'; ++sym, ++Sym, ++i)
{
String letter
= alphabet_line.
substring(i
*Lwidth,
(i
+1)*Lwidth
); alphabet.put(sym, letter);
alphabet.put(Sym, letter);
}
alphabet.put('?', alphabet_line.substring(i*Lwidth, (i+1)*Lwidth));
for(i = 0; i < Text.length(); ++i)
{
if //it is a letter
(
(('a' <= Text.charAt(i)) && (Text.charAt(i) <= 'z')) ||
(('A' <= Text.charAt(i)) && (Text.charAt(i) <= 'Z'))
)
out.print(alphabet.get(Text.charAt(i)));
else //it is definitely something weird
out.print(alphabet.get('?'));
}
out.print('\n');
}
out.flush();
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5pby4qOwoKY2xhc3MgSWRlb25lCnsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZyBhcmdzW10pCiAgICB7CiAgICAgICAgU2Nhbm5lciBpbiA9IG5ldyBTY2FubmVyKFN5c3RlbS5pbik7CiAgICAgICAgUHJpbnRXcml0ZXIgb3V0ID0gbmV3IFByaW50V3JpdGVyKFN5c3RlbS5vdXQpOwoKICAgICAgICBzaG9ydCBMd2lkdGggPSBpbi5uZXh0U2hvcnQoKSwgTGhlaWdodCA9IGluLm5leHRTaG9ydCgpOwogICAgICAgIE1hcCBhbHBoYWJldCA9IG5ldyBIYXNoTWFwKCk7CiAgICAgICAgCiAgICAgICAgaWYgKGluLmhhc05leHRMaW5lKCkpCiAgICAgICAgewogICAgICAgICAgICBpbi5uZXh0TGluZSgpOwogICAgICAgIH0KICAgICAgICAKICAgICAgICBTdHJpbmcgVGV4dCA9IGluLm5leHRMaW5lKCk7CgogICAgICAgIGZvciAoc2hvcnQgaCA9IDA7IGggPCBMaGVpZ2h0OyArK2gpCiAgICAgICAgewogICAgICAgICAgICBTdHJpbmcgYWxwaGFiZXRfbGluZSA9IGluLm5leHRMaW5lKCk7CiAgICAgICAgICAgIHNob3J0IGkgPSAwOwogICAgICAgICAgICAKICAgICAgICAgICAgZm9yKGNoYXIgc3ltID0gJ2EnLCBTeW0gPSAnQSc7IHN5bSA8PSAneic7ICsrc3ltLCArK1N5bSwgKytpKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBTdHJpbmcgbGV0dGVyID0gYWxwaGFiZXRfbGluZS5zdWJzdHJpbmcoaSpMd2lkdGgsIChpKzEpKkx3aWR0aCk7CiAgICAgICAgICAgICAgICBhbHBoYWJldC5wdXQoc3ltLCBsZXR0ZXIpOwogICAgICAgICAgICAgICAgYWxwaGFiZXQucHV0KFN5bSwgbGV0dGVyKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBhbHBoYWJldC5wdXQoJz8nLCBhbHBoYWJldF9saW5lLnN1YnN0cmluZyhpKkx3aWR0aCwgKGkrMSkqTHdpZHRoKSk7CiAgICAgICAgICAgIAogICAgICAgICAgICBmb3IoaSA9IDA7IGkgPCBUZXh0Lmxlbmd0aCgpOyArK2kpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGlmIC8vaXQgaXMgYSBsZXR0ZXIKICAgICAgICAgICAgICAgICgKICAgICAgICAgICAgICAgICAgICAoKCdhJyA8PSBUZXh0LmNoYXJBdChpKSkgJiYgKFRleHQuY2hhckF0KGkpIDw9ICd6JykpIHx8CiAgICAgICAgICAgICAgICAgICAgKCgnQScgPD0gVGV4dC5jaGFyQXQoaSkpICYmIChUZXh0LmNoYXJBdChpKSA8PSAnWicpKQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgICAgIG91dC5wcmludChhbHBoYWJldC5nZXQoVGV4dC5jaGFyQXQoaSkpKTsKICAgICAgICAgICAgICAgIGVsc2UgLy9pdCBpcyBkZWZpbml0ZWx5IHNvbWV0aGluZyB3ZWlyZAogICAgICAgICAgICAgICAgICAgIG91dC5wcmludChhbHBoYWJldC5nZXQoJz8nKSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgb3V0LnByaW50KCdcbicpOwogICAgICAgIH0KCiAgICAgICAgb3V0LmZsdXNoKCk7CiAgICB9Cn0=