#include <bits/stdc++.h>
using namespace std;
int a[1005][1005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, a1, b;
  cin >> n >> a1 >> b;
  if (n == 1 && a1 == 1 && b == 1) {
    cout << "YES" << endl;
    cout << 0 << endl;
    return 0;
  }
  if (a1 > 1 && b > 1) {
    cout << "NO" << endl;
    return 0;
  }
  if (n < 4 && a1 == 1 && b == 1) {
    cout << "NO" << endl;
    return 0;
  }
  int x = max(a1, b);
  for (long long i = 0; i < x - 1; i++) {
    for (long long j = i + 1; j < n; j++) {
      a[i][j] = 1;
      a[j][i] = 1;
    }
  }
  if (x == 1) {
    for (long long i = 0; i < n - 1; i++) {
      a[i][i + 1] = 1;
      a[i + 1][i] = 1;
    }
  }
  if (a1 != 1) {
    for (long long i = 0; i < n; i++) {
      for (long long j = i + 1; j < n; j++) {
        a[i][j] = 1 - a[i][j];
        a[j][i] = 1 - a[j][i];
      }
    }
  }
  cout << "YES" << endl;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) cout << a[i][j] << "";
    cout << endl;
  }
  return 0;
}
