#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 10;
bool g[N][N];
int main(void) {
  int n, a, b;
  cin >> n >> a >> b;
  int i, j;
  if (n == 1) {
    if (a == 1 && b == 1) {
      printf("YES\n0");
      return 0;
    }
  }
  if (a > 1 && b > 1 || n >= 2 && n <= 3 && a == 1 && b == 1) {
    printf("NO");
    return 0;
  }
  if (a == 1) {
    memset(g, true, sizeof(g));
    for (i = b; i < n; i++) {
      g[i + 1][i] = g[i][i + 1] = false;
    }
  } else {
    for (i = a; i < n; i++) {
      g[i + 1][i] = g[i][i + 1] = true;
    }
  }
  printf("YES\n");
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (i == j) {
        printf("0");
        continue;
      }
      if (g[i][j])
        printf("1");
      else
        printf("0");
    }
    printf("\n");
  }
}
