#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int n, a, b;
bool g[N][N], ans[N][N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> b;
  if ((n == 2 || n == 3) && a == 1 && b == 1) {
    cout << "NO\n";
    exit(0);
  }
  if (b == 1) {
    for (int x = a - 1, qwerty = n - 1; x < qwerty; x++)
      ans[x][x + 1] = ans[x + 1][x] = 1;
  } else if (a == 1) {
    for (int x = b - 1, qwerty = n - 1; x < qwerty; x++)
      g[x][x + 1] = g[x + 1][x] = 1;
    for (int x = 0, qwerty = n; x < qwerty; x++)
      for (int y = 0, qwerty = n; y < qwerty; y++)
        if (x != y) ans[x][y] = !g[x][y];
  } else {
    cout << "NO\n";
    exit(0);
  }
  cout << "YES\n";
  for (int x = 0, qwerty = n; x < qwerty; x++) {
    for (int y = 0, qwerty = n; y < qwerty; y++) cout << ans[x][y];
    cout << "\n";
  }
}
