#include <bits/stdc++.h>
int main() {
  int n, a, b;
  scanf("%d%d%d", &n, &a, &b);
  if (n == 1) return !printf("YES\n0\n");
  if (n == 2) {
    if (a == b) return !printf("NO\n");
    if (a == 1) return !printf("YES\n01\n10\n");
    return !printf("YES\n00\n00\n");
  }
  if (a != 1 && b != 1) return !printf("NO\n");
  if (a == 1 && b == 1) {
    if (n == 3) return !printf("NO\n");
    printf("YES\n");
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j)
        if (j == i + 1 || j == i - 1)
          printf("1");
        else
          printf("0");
      puts("");
    }
    return 0;
  } else {
    printf("YES\n");
    int p = n - std::max(a, b) + 1;
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        char c =
            (j == i + 1 || j == i - 1 ? (i <= p && j <= p ? '1' : '0') : '0');
        if (a == 1) c = (c == '1' ? '0' : '1');
        if (i == j) c = '0';
        putchar(c);
      }
      puts("");
    }
    return 0;
  }
}
