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 n, m;
char s[420];
bitset<640020> c[26], d[26];
int main() {
  int r, p;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", &s);
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < 26; k++)
        if (s[j] - 'a' == k)
          c[k].set(i * 2 * m + j), c[k].set(i * 2 * m + j + m);
    }
  }
  scanf("%d%d", &r, &p);
  for (int i = 0; i < r; i++) {
    scanf("%s", &s);
    for (int j = 0; j < p; j++) {
      for (int k = 0; k < 26; k++)
        if (s[j] - 'a' == k) d[k].set(i * m * 2 + j);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      bool flag = 0;
      int shift = i * 2 * m + j;
      for (int k = 0; k < 26; k++)
        if (((d[k] << shift) & c[k]) != (d[k] << shift)) {
          flag = 1;
          break;
        }
      if (flag)
        putchar('0');
      else
        putchar('1');
    }
    putchar('\n');
  }
  return 0;
}
