#include <bits/stdc++.h>
using namespace std;
const int N = 1001;
int n, a, b, u;
int sol[N][N];
void W() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      printf("%d", sol[i][j]);
    }
    printf("\n");
  }
}
int main() {
  cin >> n >> a >> b;
  if (a != 1 && b != 1) {
    cout << "NO";
    return 0;
  }
  if (a == 1 && b == 1) {
    if (n == 1) {
      printf("YES\n0");
      return 0;
    }
    if (n <= 3) {
      cout << "NO";
      return 0;
    }
    printf("YES\n");
    for (int i = 1; i < n; i++) {
      sol[i][i + 1] = 1;
      sol[i + 1][i] = 1;
    }
    W();
    return 0;
  }
  printf("YES\n");
  if (a != 1)
    u = a;
  else
    u = b;
  for (int i = 1; i <= n - u; i++) {
    sol[i][i + 1] = 1;
    sol[i + 1][i] = 1;
  }
  if (a != 1) {
    W();
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i != j) {
        sol[i][j] ^= 1;
      }
    }
  }
  W();
  return 0;
}
