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