#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) mt19937 mt; int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int n, a, b, c; cin >> n >> a >> b >> c; if (n <= 3) { vector x; rep(i, a) x.push_back(1); rep(i, b) x.push_back(2); rep(i, c) x.push_back(3); while (true) { shuffle(x.begin(), x.end(), mt); vector s(n); rep(i, n * n) { s[i % n].push_back(x[i] + '0'); } int dx[4] = {0, 1, 0, -1}; int dy[4] = {-1, 0, 1, 0}; bool ok = true; rep(i, n) rep(j, n) { if (s[i][j] != '2') continue; vector c(3, 0); rep(k, 4) { int nx = i + dx[k]; int ny = j + dy[k]; if (nx < 0 || ny < 0 || nx >= n || ny >= n) continue; c[s[nx][ny] - '1']++; } if (c[0] != 0 && c[2] != 0) { ok = false; } } if (ok) { for (auto t : s) cout << t << endl; return 0; } } } if (a + c <= b) { rep(i, n) { rep(j, n) { if (a) { cout << '1'; a--; } else if (b) { cout << '2'; b--; } else { cout << '3'; c--; } } cout << endl; } } else { if (a < c) { rep(i, n) { rep(j, n) { if (b) { cout << '2'; b--; } else if (c) { cout << '3'; c--; } else { cout << '1'; a--; } } cout << endl; } } else { rep(i, n) { rep(j, n) { if (b) { cout << '2'; b--; } else if (a) { cout << '1'; a--; } else { cout << '3'; c--; } } cout << endl; } } } return 0; }