#include <bits/stdc++.h>
using namespace std;
using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;
int mat[1001][1001];
int main() {
  int n, a, b;
  scanf("%d %d %d", &n, &a, &b);
  if (a != 1 && b != 1) {
    printf("NO\n");
    return 0;
  }
  if (a == 1 && b == 1) {
    if (n == 1) {
      printf("YES\n0\n");
      return 0;
    }
    if (n <= 3) {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
  int comp = max(a, b);
  int to = n - comp + 1;
  for (int i = 1; i < to; i++) mat[i][i + 1] = mat[i + 1][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (a == 1 && i != j) mat[i][j] = 1 - mat[i][j];
      printf("%d", mat[i][j]);
    }
    printf("\n");
  }
  return 0;
}
