#include <bits/stdc++.h>
using namespace std;
int n, a, b, mat[1002][1002];
int main() {
  cin >> n >> a >> b;
  if (n == 1) {
    cout << "YES\n";
    cout << 0;
    return 0;
  }
  if ((n == 2 || n == 3) && a == 1 && b == 1) {
    cout << "NO\n";
    return 0;
  }
  if (a != 1 && b != 1) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  if (a != 1)
    for (int i = 2; i <= n - a + 1; i++) {
      mat[i - 1][i] = mat[i][i - 1] = 1;
    }
  else {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        mat[i][j] = 1;
      }
    }
    for (int i = 1; i <= n; i++) {
      mat[i][i] = 0;
    }
    for (int i = 2; i <= n - b + 1; i++) {
      mat[i - 1][i] = mat[i][i - 1] = 0;
    }
  }
  for (int i = 1; i <= n; i++, cout << '\n')
    for (int j = 1; j <= n; j++) {
      cout << mat[i][j];
    }
  return 0;
}
