#include <bits/stdc++.h>
using namespace std;
int main() {
  int adjMatrix[1005][1005], n, p, q, o;
  memset(adjMatrix, 0, sizeof adjMatrix);
  scanf(" %d %d %d", &n, &p, &q);
  if (p != 1 && q != 1) {
    printf("NO\n");
    return 0;
  }
  if ((n == 3 || n == 2) && p == 1 && q == 1) {
    printf("NO\n");
    return 0;
  }
  if (p == 1)
    o = q;
  else
    o = p;
  if (o > n || o < 1) {
    printf("NO\n");
    return 0;
  }
  for (int i = 0; i < n - o; i++) {
    int u = i, v = i + 1;
    adjMatrix[u][v] = 1;
    adjMatrix[v][u] = 1;
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j)
        printf("0");
      else if (p == 1)
        printf("%d", 1 - adjMatrix[i][j]);
      else
        printf("%d", adjMatrix[i][j]);
    }
    printf("\n");
  }
}
