#include <bits/stdc++.h>
using namespace std;
int main() {
  istream &input = cin;
  ostream &output = cout;
  int N, a, b;
  input >> N >> a >> b;
  bool inverse = false;
  if (a < b) {
    int buf = a;
    a = b;
    b = buf;
    inverse = true;
  }
  if (b > 1) {
    output << "NO" << endl;
    return 0;
  }
  vector<int> mtx(N * N);
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < N; ++j) {
      mtx[i * N + j] = 0;
    }
  if (N == 1) {
    output << "YES" << endl;
    output << 0 << endl;
    return 0;
  }
  if (a == 1) {
    if (N < 4) {
      output << "NO" << endl;
      return 0;
    }
    for (int i = 0; i < N - 1; ++i) mtx[i * N + 0] = 1;
    for (int i = 0; i < N - 1; ++i) mtx[0 * N + i] = 1;
    mtx[(N - 1) * N + (N - 2)] = 1;
    mtx[(N - 2) * N + (N - 1)] = 1;
  } else {
    for (int i = 0; i < N; ++i)
      for (int j = 0; j < N; ++j) {
        mtx[i * N + j] = 1;
      }
    for (int k = 0; k < a - 1; ++k) {
      for (int i = 0; i < N; ++i) mtx[i * N + k] = 0;
      for (int i = 0; i < N; ++i) mtx[k * N + i] = 0;
    }
    if (inverse)
      for (int i = 0; i < N; ++i)
        for (int j = 0; j < N; ++j) {
          mtx[i * N + j] = 1 - mtx[i * N + j];
        }
  }
  for (int i = 0; i < N; ++i) mtx[i * N + i] = 0;
  output << "YES" << endl;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) output << mtx[i * N + j];
    output << endl;
  }
  return 0;
}
