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, i, t, g[(1 << 20)];
complex<double> a[(1 << 20)], b[(1 << 20)];
void FFTinit() {
  for (i = 1; i < (1 << 20); i++) g[i] = g[i >> 1] >> 1 | ((i & 1) << 19);
}
void FFT(complex<double> *a, int f) {
  int i, j, k, p;
  for (i = 0; i < (1 << 20); i++)
    if (g[i] > i) swap(a[i], a[g[i]]);
  for (i = 1; i < (1 << 20); i <<= 1) {
    complex<double> e(cos(acos(-1) / i), f * sin(acos(-1) / i));
    for (j = 0; j < (1 << 20); j += i << 1) {
      complex<double> w(1, 0);
      for (k = 0; k < i; k++, w *= e) {
        complex<double> first = a[j + k], second = w * a[j + k + i];
        a[j + k] = first + second;
        a[j + k + i] = first - second;
      }
    }
  }
}
void match(int *ma, int *mb, int *res) {
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  for (int i = 0; i < (1 << 20); i++) {
    a[i] = ma[i];
    b[i] = mb[i];
  }
  FFT(a, 1);
  FFT(b, 1);
  for (int i = 0; i < (1 << 20); i++) a[i] = a[i] * b[i];
  FFT(a, -1);
  for (int i = 0; i < (1 << 20); i++) {
    res[i] = (int)(a[i].real() / (1 << 20) + 0.5);
  }
}
int A[3][(1 << 20)], B[4][(1 << 20)], res[(1 << 20)];
int main() {
  FFTinit();
  int n, m;
  scanf("%d %d", &n, &m);
  char c[405][405];
  for (int i = 0; i < n; i++) scanf("%s", c[i]);
  char c2[405][405];
  int R, complex<double>;
  scanf("%d %d", &R, &complex<double>);
  for (int i = 0; i < R; i++) {
    scanf("%s", c2[i]);
  }
  int sum[405][405];
  memset(sum, 0, sizeof(sum));
  memset(A, 0, sizeof(A));
  memset(B, 0, sizeof(B));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      A[0][i * m * 2 + j] = 1;
      for (int k = 1; k < 3; k++) {
        A[k][i * m * 2 + j] = A[k - 1][i * m * 2 + j] * (c[i][j] - 'a' + 1);
      }
    }
  }
  for (int i = 0; i < R; i++) {
    for (int j = 0; j < complex<double>; j++) {
      B[0][(n - i) % n * m * 2 + (m - j) % m] = 1;
      for (int k = 1; k < 4; k++) {
        if (c2[i][j] == '?')
          B[k][(n - i) % n * m * 2 + (m - j) % m] = 0;
        else
          B[k][(n - i) % n * m * 2 + (m - j) % m] =
              B[k - 1][(n - i) % n * m * 2 + (m - j) % m] *
              (c2[i][j] - 'a' + 1);
      }
    }
  }
  match(A[0], B[3], res);
  for (int j = 0; j < (1 << 20); j++) {
    if (res[j]) {
      int first = (j / (2 * m)) % n, second = (j % (2 * m)) % m;
      sum[first][second] += res[j];
    }
  }
  match(A[1], B[2], res);
  for (int j = 0; j < (1 << 20); j++) {
    if (res[j]) {
      int first = (j / (2 * m)) % n, second = (j % (2 * m)) % m;
      sum[first][second] += -2 * res[j];
    }
  }
  match(A[2], B[1], res);
  for (int j = 0; j < (1 << 20); j++) {
    if (res[j]) {
      int first = (j / (2 * m)) % n, second = (j % (2 * m)) % m;
      sum[first][second] += res[j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (sum[i][j] == 0) {
        printf("1");
      } else {
        printf("0");
      }
    }
    printf("\n");
  }
}
