#include <bits/stdc++.h>
using namespace std;
int mat[1123][1123];
int main() {
  int n, a, b;
  scanf("%d %d %d", &n, &a, &b);
  if (n == 1) {
    printf("YES\n0\n");
  } else if (n != 1 && (a != 1 && b != 1)) {
    puts("NO");
  } else {
    if (a == 1 && b == 1) {
      if (n <= 3) return puts("NO"), 0;
      for (int i = 1; i < n; i++) mat[i][i + 1] = mat[i + 1][i] = 1;
    } else if (a == 1) {
      for (int i = 1; i < b; i++) {
        for (int j = i + 1; j <= n; j++) mat[i][j] = mat[j][i] = 1;
      }
    } else {
      for (int i = 1; i < a; i++) {
        for (int j = i + 1; j <= n; j++) {
          mat[i][j] = mat[j][i] = 1;
        }
      }
      for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
          if (i == j) continue;
          mat[i][j] ^= 1;
        }
      }
    }
    puts("YES");
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        printf("%d", mat[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}
