#include <bits/stdc++.h>
#pragma optimize("Ofast")
using namespace std;
bool Finish_read;
template <class T>
inline void read(T &x) {
  Finish_read = 0;
  x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    if (ch == EOF) return;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x *= f;
  Finish_read = 1;
}
template <class T>
inline void print(T x) {
  if (x / 10 != 0) print(x / 10);
  putchar(x % 10 + '0');
}
template <class T>
inline void writeln(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
  putchar('\n');
}
template <class T>
inline void write(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
  putchar(' ');
}
int mapp[1005][1005];
int main() {
  int n, a, b;
  scanf("%d%d%d", &n, &a, &b);
  if (min(a, b) != 1 || (n == 2 && a == 1 && b == 1) ||
      (n == 3 && a == 1 && b == 1)) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  memset(mapp, 0, sizeof(mapp));
  int tmp = max(a, b);
  for (int i = tmp; i < n; i++) mapp[i][i + 1] = mapp[i + 1][i] = 1;
  if (tmp == a) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) printf("%d", mapp[i][j]);
      printf("\n");
    }
  } else {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++)
        printf("%d", i == j ? mapp[i][j] : 1 - mapp[i][j]);
      printf("\n");
    }
  }
  return 0;
}
