#include <bits/stdc++.h>
using namespace std;
int M[1020][1020];
int main() {
  int N, a, b;
  scanf("%d%d%d", &N, &a, &b);
  bool fl = 0;
  if (a != 1 && b != 1) {
    printf("NO\n");
    return 0;
  }
  if (a == 1 && b == 1) {
    if (N == 3 || N == 2) {
      printf("NO\n");
      return 0;
    }
  }
  fl = (a == 1);
  printf("YES\n");
  if (a == 1 && b == 1) {
    if (N == 1) {
      printf("0\n");
      return 0;
    }
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        if (i == j + 1) {
          M[i][j] = 1;
          M[j][i] = 1;
        }
      }
    }
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        printf("%d", M[i][j]);
      }
      printf("\n");
    }
  } else {
    int u = max(a, b);
    for (int i = u - 1; i < N; i++) {
      for (int j = u - 1; j < N; j++) {
        if (i != j) {
          M[i][j] = 1;
        }
      }
    }
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        if (i != j) {
          M[i][j] = M[i][j] ^ fl;
        }
      }
    }
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        printf("%d", M[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}
