#include <bits/stdc++.h>
using namespace std;
int n, a, b;
bool rev;
int mtx[2000][2000];
int main() {
  scanf("%d%d%d", &n, &a, &b);
  if ((a != 1 && b != 1) || (a == 1 && b == 1 && (n == 2 || n == 3))) {
    puts("NO");
    return 0;
  }
  if (a == 1 && b == 1) {
    puts("YES");
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        putchar(i == j + 1 || i == j - 1 ? '1' : '0');
      }
      puts("");
    }
    return 0;
  }
  if (a == 1) {
    rev = true;
    swap(a, b);
  }
  for (int i = a + 1; i <= n; i++) {
    mtx[1][i] = mtx[i][1] = 1;
  }
  puts("YES");
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i != j) mtx[i][j] ^= rev;
      printf("%d", mtx[i][j]);
    }
    puts("");
  }
  return 0;
}
