#include <bits/stdc++.h>
using namespace std;
int e[1010][1010];
int main(void) {
  int n, a, b;
  scanf("%d%d%d", &n, &a, &b);
  if (a > 1 && b > 1) {
    printf("NO\n");
    return 0;
  }
  int x = n - max(a, b) + 1;
  if (x <= 0 || ((n == 2 || n == 3) && x == n)) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  for (int i = 0; i < x - 1; i++) e[i][i + 1] = e[i + 1][i] = 1;
  if (b != 1)
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        if (i != j) e[i][j] = 1 - e[i][j];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) printf("%d", e[i][j]);
    puts("");
  }
  return 0;
}
