#include <bits/stdc++.h>
using namespace std;
const int MOD = 5000000;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a * (b / gcd(a, b));
}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
int ddx[] = {0, 0, 1, 1, 1, -1, -1, -1}, ddy[] = {1, -1, 1, 0, -1, 1, 0, -1};
bool chk[1001][1001];
int main() {
  int n, a, b;
  scanf("%d%d%d", &n, &a, &b);
  if (a != 1 && b != 1) return !printf("NO");
  if (a == 1 && b == 1) {
    if (n == 2 || n == 3) return !printf("NO");
    puts("YES");
    for (int(i) = (2); (i) <= (n); (i) += (1))
      chk[i][i - 1] = chk[i - 1][i] = 1;
    for (int(i) = (1); (i) <= (n); (i) += (1)) {
      for (int(j) = (1); (j) <= (n); (j) += (1)) printf("%d", chk[i][j]);
      puts("");
    }
    return 0;
  }
  puts("YES");
  if (b == 1) {
    for (int(i) = (2); (i) <= (n - a + 1); (i) += (1))
      chk[1][i] = chk[i][1] = 1;
  } else {
    for (int(i) = (2); (i) <= (n - b + 1); (i) += (1))
      chk[1][i] = chk[i][1] = 1;
    for (int(i) = (1); (i) <= (n); (i) += (1))
      for (int(j) = (1); (j) <= (n); (j) += (1))
        if (i != j) chk[i][j] = !chk[i][j];
  }
  for (int(i) = (1); (i) <= (n); (i) += (1)) {
    for (int(j) = (1); (j) <= (n); (j) += (1)) printf("%d", chk[i][j]);
    puts("");
  }
}
