#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int n1, long long int n2) {
  if (n2 != 0)
    return gcd(n2, n1 % n2);
  else
    return n1;
}
long long int power(long long int a, long long int b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long int x = power(a, b / 2);
  if (b & 1) {
    return a * x * x;
  }
  return x * x;
}
const long long int PINF = numeric_limits<long long int>::max();
const long long int NINF = numeric_limits<long long int>::min();
const int SIZE = 200005;
vector<int> v[SIZE];
int vis[SIZE];
int l[SIZE];
void bfs(int x) {
  queue<int> q;
  l[x] = 0;
  q.push(x);
  while (!q.empty()) {
    int y = q.front();
    q.pop();
    for (int k = 0; k < v[y].size(); k++) {
      if (l[v[y][k]] == 0) {
        l[v[y][k]] = l[y] + 1;
        q.push(v[y][k]);
      }
    }
  }
}
int arr[1003][1003];
void discon(int n) {
  for (__typeof((n)) i = (1); i <= (n); i++) {
    for (__typeof((n)) j = (1); j <= (n); j++)
      if (i != j) {
        arr[i][j] = (arr[i][j] == 0) ? 1 : 0;
      }
  }
}
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  if ((a == 1 || b == 1)) {
    memset(arr, 0, sizeof(arr));
    int k = (a == 1) ? b : a;
    if ((n == 2 || n == 3) && (a == 1 && b == 1)) {
      cout << "NO\n";
      return 0;
    }
    for (__typeof((n - k)) i = (1); i <= (n - k); i++) {
      arr[i][i + 1] = arr[i + 1][i] = 1;
    }
    if (a == 1 && b != 1) discon(n);
    cout << "YES\n";
    for (__typeof((n)) i = (1); i <= (n); i++) {
      for (__typeof((n)) j = (1); j <= (n); j++) cout << arr[i][j];
      cout << "\n";
    }
  } else
    cout << "NO\n";
}
