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