#include <bits/stdc++.h>
int n, a, b, x[1005][1005];
int main() {
  scanf("%d%d%d", &n, &a, &b);
  if (n == 1) {
    puts("YES");
    puts("0");
    return 0;
  } else if (n == 2 && a == 1 && b == 1) {
    puts("NO");
    return 0;
  } else if (n == 3 && a == 1 && b == 1) {
    puts("NO");
    return 0;
  } else if (a == 1 && b == 1) {
    for (int i = (1); i <= (n - 1); ++i) x[i][i + 1] = x[i + 1][i] = true;
  } else if (a > 1 && b > 1) {
    puts("NO");
    return 0;
  } else if (b == 1) {
    memset(x, 0, sizeof(x));
    for (int i = (1); i <= (n - a + 1); ++i) {
      for (int j = (1); j <= (n - a + 1); ++j) {
        x[i][j] = 1;
      }
    }
  } else if (a == 1) {
    memset(x, 1, sizeof(x));
    for (int i = (1); i <= (n - b + 1); ++i) {
      for (int j = (1); j <= (n - b + 1); ++j) {
        x[i][j] = 0;
      }
    }
  }
  puts("YES");
  for (int i = (1); i <= (n); ++i) {
    for (int j = (1); j <= (n); ++j) {
      if (i == j)
        putchar('0');
      else
        putchar(x[i][j] + '0');
    }
    puts("");
  }
}
