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;
const int MOD = 998244353;
const int N = 1000105;
const double PI = 4 * atan(1);
const double eps = 1e-7;
const long long oo = 1e10;
using cd = complex<double>;
int reverse(int num, int lg_n) {
  int res = 0;
  for (int i = 0; i < lg_n; i++) {
    if (num & (1 << i)) res |= 1 << (lg_n - 1 - i);
  }
  return res;
}
void fft(vector<cd>& a, bool invert) {
  int n = a.size();
  int lg_n = 0;
  while ((1 << lg_n) < n) lg_n++;
  for (int i = 0; i < n; i++) {
    if (i < reverse(i, lg_n)) swap(a[i], a[reverse(i, lg_n)]);
  }
  for (int len = 2; len <= n; len <<= 1) {
    double ang = 2 * PI / len * (invert ? -1 : 1);
    cd wlen(cos(ang), sin(ang));
    for (int i = 0; i < n; i += len) {
      cd w(1);
      for (int j = 0; j < len / 2; j++) {
        cd u = a[i + j], v = a[i + j + len / 2] * w;
        a[i + j] = u + v;
        a[i + j + len / 2] = u - v;
        w *= wlen;
      }
    }
  }
  if (invert) {
    for (cd& x : a) x /= n;
  }
}
vector<int> multiply(vector<cd> const& a, vector<cd> const& b) {
  vector<cd> fa(a.begin(), a.end()), fb(b.begin(), b.end());
  int n = 1;
  while (n < a.size() + b.size()) {
    n <<= 1;
  }
  fa.resize(n);
  fb.resize(n);
  fft(fa, false);
  fft(fb, false);
  for (int i = 0; i < n; i++) {
    fa[i] *= fb[i];
  }
  fft(fa, true);
  vector<int> result(n);
  for (int i = 0; i < n; i++) {
    if (fabs(round(fa[i].real()) - fa[i].real() < 0.001)) {
      result[i] = round(fa[i].real());
    } else {
      result[i] = floor(fa[i].real());
    }
  }
  return result;
}
long long t, n, m;
long long dp[804][808];
long long num = 0;
char grid[808][808];
char pattern[404][404];
vector<cd> a, b;
vector<int> c;
long long l, r;
long long k;
long long mulx, muly;
vector<cd> getv(long long pos, long long type) {
  vector<cd> res;
  if (type == 0) {
    res.resize(muly * m);
    for (int j = 0; j < muly * m; j++) {
      double ang = (2 * PI * (grid[pos][j] - 'a')) / 26;
      res[j] = cd(cos(ang), sin(ang));
    }
  } else {
    res.resize(r);
    num = 0;
    for (int j = 0; j < r; j++) {
      if (pattern[pos][r - j - 1] == '?') {
        num++;
        res[j] = cd(0, 0);
        continue;
      }
      double ang = (2 * PI * (pattern[pos][r - j - 1] - 'a')) / 26;
      res[j] = cd(cos(ang), -sin(ang));
    }
  }
  return res;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> grid[i][j];
    }
  }
  cin >> l >> r;
  for (int i = 0; i < l; i++) {
    for (int j = 0; j < r; j++) {
      cin >> pattern[i][j];
    }
  }
  mulx = (l + n - 1) / n;
  muly = (r + m - 1) / m;
  mulx = (mulx > 2 ? mulx : 2);
  muly = (muly > 2 ? muly : 2);
  for (int i = 0; i < mulx; i++) {
    for (int j = 0; j < muly; j++) {
      for (int k = 0; k < n; k++) {
        for (int u = 0; u < m; u++) {
          grid[k + i * n][u + j * m] = grid[k][u];
        }
      }
    }
  }
  for (int i = 0; i < mulx * n; i++) {
    a = getv(i, 0);
    for (int j = 0; j < l; j++) {
      num = 0;
      b = getv(j, 1);
      c = multiply(a, b);
      for (int k = 0; k < m * muly - r + 1; k++) {
        bool cond = (c[r - 1 + k] == (r - num));
        if (j <= i) {
          dp[i - j][k] += cond;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      bool cond = (dp[i][j] == l);
      cout << cond;
    }
    cout << endl;
  }
  return 0;
}
