#include <bits/stdc++.h>
using namespace std;
int c[1005][1005];
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  if (n == 1) {
    cout << "YES" << endl << "0" << endl;
    return 0;
  }
  if (((n == 2 || n == 3) && max(a, b) == 1) || min(a, b) != 1) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  memset(c, 0, sizeof c);
  if (max(a, b) == 1) {
    for (int i = 1; i < n; i++) {
      c[i][i + 1] = 1, c[i + 1][i] = 1;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        printf("%d", c[i][j]);
      }
      puts("");
    }
    return 0;
  }
  if (a < b) {
    for (int i = n; i > n - b + 1; i--) {
      for (int j = 1; j < i; j++) {
        c[i][j] = 1, c[j][i] = 1;
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        printf("%d", c[i][j]);
      }
      puts("");
    }
    return 0;
  }
  swap(a, b);
  for (int i = n; i > n - b + 1; i--) {
    for (int j = 1; j < i; j++) {
      c[i][j] = 1, c[j][i] = 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j) c[i][j] = 1;
      printf("%d", (c[i][j] + 1) % 2);
    }
    puts("");
  }
}
