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