#include <bits/stdc++.h>
using namespace std;
const int nmax = 1005;
int n, a, b;
int mat[nmax][nmax];
int main() {
  scanf("%d %d %d", &n, &a, &b);
  if (a != 1 && b != 1)
    printf("NO\n");
  else if ((n == 2 || n == 3) && a == 1 && b == 1)
    printf("NO\n");
  else {
    printf("YES\n");
    int conta = 1, contb = 0;
    if (b != 1) swap(a, b), swap(conta, contb);
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= n; ++j)
        if (i != j) mat[i][j] = mat[j][i] = contb;
    for (int i = a; i <= n; ++i) mat[i][i + 1] = mat[i + 1][i] = conta;
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        printf("%d", mat[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}
