#include <bits/stdc++.h>
int e[1005][1005], n, a, b;
void add(int x, int y) { e[x][y] = e[y][x] = 1; }
void print(int x) {
  for (int i = (1); i <= (n); ++i) {
    for (int j = (1); j <= (n); ++j) printf("%d", e[i][j] ^ x);
    printf("\n");
  }
}
int main() {
  scanf("%d%d%d", &n, &a, &b);
  if (n == 1 && a == 1 && b == 1)
    printf("YES\n0\n");
  else if (n <= 3 && a == 1 && b == 1)
    printf("NO\n");
  else if (a > n || b > n || (a != 1 && b != 1))
    printf("NO\n");
  else {
    printf("YES\n");
    if (a == 1 && b == 1) {
      for (int i = (1); i <= (n - 1); ++i) add(i, i + 1);
      print(0);
    } else if (a == 1 && b != 1) {
      for (int i = (1); i <= (n - b + 1); ++i)
        for (int j = (1); j <= (n - b + 1); ++j) add(i, j);
      for (int i = (1); i <= (n); ++i) e[i][i] = 1;
      print(1);
    } else {
      for (int i = (1); i <= (n - a + 1); ++i)
        for (int j = (1); j <= (n - a + 1); ++j) add(i, j);
      for (int i = (1); i <= (n); ++i) e[i][i] = 0;
      print(0);
    }
  }
  return 0;
}
