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 double PI = acos(-1.0);
void fft(valarray<complex<double> > &x) {
  int N = x.size();
  if (N <= 1) return;
  valarray<complex<double> > even = x[slice(0, N / 2, 2)];
  valarray<complex<double> > odd = x[slice(1, N / 2, 2)];
  fft(even);
  fft(odd);
  for (int k = 0; k < N / 2; ++k) {
    complex<double> t = polar(1.0, -2.0 * PI * k / N) * odd[k];
    x[k] = even[k] + t;
    x[k + N / 2] = even[k] - t;
  }
}
void ifft(valarray<complex<double> > &x) {
  x = x.apply(conj);
  fft(x);
  x = x.apply(conj);
  x /= x.size();
}
void fft2d(vector<valarray<complex<double> > > &X) {
  for (int i = 0; i < X.size(); i++) fft(X[i]);
  for (int i = 0; i < X[0].size(); i++) {
    valarray<complex<double> > tmp(X.size());
    for (int j = 0; j < X.size(); j++) tmp[j] = X[j][i];
    fft(tmp);
    for (int j = 0; j < X.size(); j++) X[j][i] = tmp[j];
  }
}
void ifft2d(vector<valarray<complex<double> > > &X) {
  for (int i = 0; i < X.size(); i++) ifft(X[i]);
  for (int i = 0; i < X[0].size(); i++) {
    valarray<complex<double> > tmp(X.size());
    for (int j = 0; j < X.size(); j++) tmp[j] = X[j][i];
    ifft(tmp);
    for (int j = 0; j < X.size(); j++) X[j][i] = tmp[j];
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  string a[801];
  for (int i = 0; i < n; i++) cin >> a[i];
  int r, c;
  cin >> r >> c;
  string b[401];
  for (int i = 0; i < r; i++) cin >> b[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < c - 1; j++) a[i] += a[i][j];
    if (i < r - 1) a[i + n] = a[i];
  }
  int nn = n + r - 1, mm = m + c - 1, b2n = 1, b2m = 1;
  while (b2n <= max(nn, r)) b2n <<= 1;
  while (b2m <= max(mm, c)) b2m <<= 1;
  vector<valarray<complex<double> > > A(b2n, valarray<complex<double> >(b2m));
  for (int i = 0; i < nn; i++)
    for (int j = 0; j < mm; j++) {
      double ang = 2.0 * PI * (a[i][j] - 'a') / 26.0;
      A[i][j] = complex<double>(cos(ang), sin(ang));
    }
  fft2d(A);
  int q = 0;
  vector<valarray<complex<double> > > B(b2n, valarray<complex<double> >(b2m));
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++)
      if (b[i][j] != '?') {
        double ang = -2.0 * PI * (b[i][j] - 'a') / 26.0;
        B[r - i - 1][c - j - 1] = complex<double>(cos(ang), sin(ang));
        q++;
      }
  fft2d(B);
  for (int i = 0; i < A.size(); i++)
    for (int j = 0; j < A[i].size(); j++) A[i][j] *= B[i][j];
  ifft2d(A);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++)
      if (floor(A[i + r - 1][j + c - 1].real() + 0.0000001) == q)
        cout << "1";
      else
        cout << "0";
    cout << endl;
  }
  return 0;
}
