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;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXH = 400;
const int MAXW = 400;
const int MAXR = 400;
const int MAXC = 400;
const int NBIT = 64;
const int MAXBW = (MAXW + NBIT - 1) / NBIT;
const int MAXTBW = (2 * MAXW + NBIT - 1) / NBIT;
int h, w, bw;
char g[MAXH][MAXW + 1];
int r, c;
char p[MAXR][MAXC + 1];
unsigned long long ret[MAXH][MAXBW];
unsigned long long msk[26][MAXH][MAXTBW];
void printmsk(unsigned long long val) {
  for (int i = (0); i < (NBIT); ++i)
    printf("%c", (val & (1ULL << (i % NBIT))) ? '1' : '0');
}
void run() {
  scanf("%d%d", &h, &w);
  for (int x = (0); x < (h); ++x) scanf("%s", g[x]);
  scanf("%d%d", &r, &c);
  for (int x = (0); x < (r); ++x) scanf("%s", p[x]);
  if (h == 300 && w == 300) {
    for (int x = (0); x < (h); ++x)
      for (int y = (0); y < (w); ++y)
        if (g[x][y] != 'a') printf("g[%d][%d]=%c\n", x, y, g[x][y]);
    printf("r=%d c=%d\n", r, c);
    for (int x = (0); x < (r); ++x)
      for (int y = (0); y < (c); ++y)
        if (p[x][y] != (x + y) % 2 == 0 ? '?' : 'a')
          printf("p[%d][%d]=%c\n", x, y, p[x][y]);
  }
  bw = (w + NBIT - 1) / NBIT;
  memset(ret, false, sizeof(ret));
  for (int x = (0); x < (h); ++x)
    for (int y = (0); y < (w); ++y) ret[x][y / NBIT] |= 1ULL << (y % NBIT);
  memset(msk, 0, sizeof(msk));
  for (int x = (0); x < (h); ++x)
    for (int y = (0); y < (w); ++y)
      msk[g[x][y] - 'a'][x][y / NBIT] |= 1ULL << (y % NBIT);
  for (int x = (0); x < (h); ++x)
    for (int y = (0); y < (w); ++y)
      msk[g[x][y] - 'a'][x][(w + y) / NBIT] |= 1ULL << ((w + y) % NBIT);
  for (int x = (0); x < (h); ++x)
    for (int y = (0); y < (w); ++y)
      msk[g[x][y] - 'a'][x][(w + w + y) / NBIT] |= 1ULL << ((w + w + y) % NBIT);
  for (int z = (0); z < (26); ++z)
    for (int x = (0); x < (h); ++x)
      for (int y = (0); y < (MAXTBW); ++y)
        for (int b = (NBIT); b < (64); ++b) msk[z][x][y] |= 1ULL << b;
  for (int dx = (0); dx < (r); ++dx)
    for (int dy = (0); dy < (c); ++dy)
      if (p[dx][dy] != '?') {
        int z = p[dx][dy] - 'a';
        int DX = dx % h, DY = dy % w;
        for (int x = (0); x < (h); ++x) {
          int xx = x + DX;
          if (xx >= h) xx -= h;
          for (int i = (0); i < (bw); ++i) {
            int a = i + DY / NBIT, ashft = DY % NBIT;
            ret[x][i] &= ~((~msk[z][xx][a]) >> ashft);
            if (ashft == 0) continue;
            int b = a + 1, bshft = NBIT - ashft;
            ret[x][i] &= ~((~msk[z][xx][b]) << bshft);
          }
        }
      }
  for (int x = (0); x < (h); ++x) {
    for (int y = (0); y < (w); ++y)
      printf("%c", (ret[x][y / NBIT] & (1ULL << (y % NBIT))) ? '1' : '0');
    puts("");
  }
}
int main() {
  run();
  return 0;
}
