#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;
int n, a, b;
int answ[N][N];
int main() {
  cin >> n >> a >> b;
  if (a > 1 && b > 1) {
    cout << "NO" << endl;
    return 0;
  }
  if (n > 1 && n <= 3 && a == b && a == 1) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  if (a == b && a == 1) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (abs(i - j) == 1)
          printf("1");
        else
          printf("0");
      }
      cout << endl;
    }
    return 0;
  }
  int c = max(a, b);
  for (int i = 1; i < c; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      answ[i][j] = answ[j][i] = 1;
    }
  }
  if (b == 1) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (i == j) continue;
        answ[i][j] ^= 1;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      printf("%d", answ[i][j]);
    }
    cout << endl;
  }
  return 0;
}
