#include <bits/stdc++.h>
using namespace std;
const long long N = 1e3 + 69, base = 1024 * 1024, mod = 1e9 + 7;
int t[N][N], n, a, b, zap;
void pisz() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cout << t[i][j];
    }
    cout << "\n";
  }
}
int32_t main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> b;
  if (a != 1 && b != 1) {
    cout << "NO\n";
    return 0;
  }
  if (a == 1 && b == 1 && n < 4 && n != 1) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  if (a == 1) swap(a, b), zap = 1;
  int ile = n - a + 1;
  for (int i = 1; i < ile; i++) {
    t[i][i + 1] = 1;
    t[i + 1][i] = 1;
  }
  if (zap == 1) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (i == j) continue;
        t[i][j] ^= 1;
      }
    }
  }
  pisz();
}
