8 10
cwcwcwcwcw
crcrcrcrcr
cwcwcwcwcw
crcrcrcrcr
cwcwcwcwcw
crcrcrcrcr
cwcwcwcwcw
crcrcrcrcr
12 14
?????r??c?????
?????w????cw?w
??????cr????c?
c?????c??????w
c???????????c?
??c?????cw????
????c?c?c?????
c?????????c???
c?????c?????c?
??????????c??w
?r????c??r????
???w?w??c???c?

0000000000
1010101010
0000000000
1010101010
0000000000
1010101010
0000000000
1010101010

#include <bits/stdc++.h>
using namespace std;
int a, b;
char ab[404][404];
int c, d;
char ch;
bitset<404> cover[26][404];
bitset<404> ans[404];
bitset<404> tmp;
int main() {
  scanf("%d%d", &a, &b);
  for (int i = 0; i < a; i++) ans[i].flip();
  for (int i = 0; i < a; i++)
    for (int j = 0; j < b; j++) {
      scanf(" %c", &ab[i][j]);
      cover[ab[i][j] - 'a'][i][j] = 1;
    }
  scanf("%d%d", &c, &d);
  for (int ii = 0; ii < c; ii++)
    for (int jj = 0; jj < d; jj++) {
      scanf(" %c", &ch);
      if (ch == '?') continue;
      for (int i = 0; i < a; i++) {
        tmp = cover[ch - 'a'][(i + ii) % a];
        ans[i] &= ((tmp >> jj) | (tmp << (b - jj)));
      }
    }
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) putchar(ans[i][j] ? '1' : '0');
    putchar('\n');
  }
}
