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;
namespace XDYIMCMI0LY {
const int N = 400 + 5;
int n;
int m;
int r;
int c;
char s[N][N + N];
char t[N][N];
struct node {
  string s;
  int key[2];
  node(){};
  node(char *l, char *r) {
    s = "";
    for (char *i = l; i <= r; ++i) {
      s += *i;
    }
  }
};
class hasher {
 public:
  int n;
  int p;
  int base;
  vector<int> fac;
  inline void add(int &a, int b) {
    a += b;
    if (a >= p) {
      a -= p;
    }
  }
  inline void sub(int &a, int b) {
    a -= b;
    if (a < 0) {
      a += p;
    }
  }
  inline int mul(int a, int b) { return (long long)a * b % p; }
  hasher(int _n, int _p, int _base) : n(_n), p(_p), base(_base) {
    fac.resize(n, 0);
    fac[0] = 1;
    for (int i = 1; i < n; ++i) {
      fac[i] = mul(fac[i - 1], base);
    }
  }
  int getkey(char *s, char *t) {
    int res = 0;
    for (char *i = s, j = 0; i <= t; ++i, ++j) {
      if (*i != '?') {
        add(res, mul(*i - 'a', fac[j]));
      }
    }
    return res;
  }
  void remove(node &t, vector<int> &v, int k) {
    for (auto i : v) {
      sub(t.key[k], mul(t.s[i] - 'a', fac[i]));
    }
  }
  void addval(node &t, vector<int> &v, int k) {
    for (auto i : v) {
      add(t.key[k], mul(t.s[i] - 'a', fac[i]));
    }
  }
};
node nodes[N][N + N];
bool ok[N][N][N];
void solve() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = m; j < 2 * m; ++j) {
      s[i][j] = s[i][j - m];
    }
  }
  cin >> r >> c;
  for (int i = 0; i < r; ++i) {
    cin >> t[i];
  }
  hasher a(c, (int)1e9 + 9, 131);
  hasher b(c, (int)1e9 + 7, 131);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 2 * m; ++j) {
      int l = j;
      int r = j + c - 1;
      if (r >= 2 * m) {
        break;
      }
      nodes[i][j] = node(s[i] + l, s[i] + r);
      nodes[i][j].key[0] = a.getkey(s[i] + l, s[i] + r);
      nodes[i][j].key[1] = b.getkey(s[i] + l, s[i] + r);
    }
  }
  for (int k = 0; k < r; ++k) {
    vector<int> ign;
    for (int i = 0; i < c; ++i) {
      if (t[k][i] == '?') {
        ign.push_back(i);
      }
    }
    int key0 = a.getkey(t[k], t[k] + c - 1);
    int key1 = b.getkey(t[k], t[k] + c - 1);
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        a.remove(nodes[i][j], ign, 0);
        b.remove(nodes[i][j], ign, 1);
        if (nodes[i][j].key[0] == key0 && nodes[i][j].key[1] == key1) {
          ok[i][j][k] = 1;
        }
        a.addval(nodes[i][j], ign, 0);
        b.addval(nodes[i][j], ign, 1);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      bool flg = 1;
      for (int k = 0; k < r; ++k) {
        if (!ok[(i + k) % n][j][k]) {
          flg = 0;
          break;
        }
      }
      cout << flg;
    }
    cout << endl;
  }
}
}  // namespace XDYIMCMI0LY
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  XDYIMCMI0LY::solve();
  flush(cout);
  return 0;
}
