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