#include <bits/stdc++.h>
using namespace std;
long long mp[1005][1005];
long long n, a, b;
void output() {
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      if (i == j)
        printf("0");
      else
        printf("%lld", a < b ? !mp[i][j] : mp[i][j]);
    }
    printf("\n");
  }
}
int main() {
  scanf("%lld%lld%lld", &n, &a, &b);
  long long root = 2;
  if ((a != 1 && b != 1)) {
    printf("NO\n");
    return 0;
  }
  if (n == 2 && a == 1 && b == 1) {
    printf("NO\n");
    return 0;
  }
  if (n == 3 && a == 1 && b == 1) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  if (a == 1 && b == 1)
    for (long long i = 1; i < n; i++) mp[i][i + 1] = mp[i + 1][i] = true;
  else
    for (long long i = 0; i < n - max(a, b); i++, root++)
      mp[1][root] = mp[root][1] = true;
  output();
}
