#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  scanf("%d%d%d", &n, &a, &b);
  if ((a == 1 || b == 1) && !((n == 2 || n == 3) && a == 1 && b == 1)) {
    printf("YES\n");
    if (a == 1 && b == 1) {
      for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
          if (i == j) {
            printf("0");
            continue;
          }
          if (abs(i - j) == 1)
            printf("1");
          else
            printf("0");
        }
        printf("\n");
      }
    } else if (a == 1) {
      for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
          if (i == j) {
            printf("0");
            continue;
          }
          if (n - i < b - 1 || n - j < b - 1)
            printf("1");
          else
            printf("0");
        }
        printf("\n");
      }
    } else if (b == 1) {
      for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
          if (i == j) {
            printf("0");
            continue;
          }
          if (n - i < a - 1 || n - j < a - 1)
            printf("0");
          else
            printf("1");
        }
        printf("\n");
      }
    }
  } else
    printf("NO\n");
  return 0;
}
