#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> build(int n, int d) {
  vector<vector<int>> g(n);
  for (int i = 0; i < n; i++) {
    g[i].resize(n);
  }
  for (int i = 0, cnt = 0; n - d != cnt; i++, cnt++) {
    g[i][i + 1] = 1;
    g[i + 1][i] = 1;
  }
  return g;
}
void inv(vector<vector<int>>& g) {
  for (size_t i = 0; i < g.size(); i++) {
    for (size_t j = 0; j < g[i].size(); j++) {
      g[i][j] ^= 1;
    }
  }
  for (int i = 0; i < g.size(); i++) g[i][i] = 0;
}
int main() {
  int n, a, b;
  scanf("%i %i %i", &n, &a, &b);
  if (min(a, b) > 1) {
    cout << "NO" << endl;
    return 0;
  }
  if (n == 2 && a == 1 && b == 1) {
    cout << "NO" << endl;
    return 0;
  }
  if (n == 3 && a == 1 && b == 1) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  auto g = build(n, max(a, b));
  if (b > a) inv(g);
  for (size_t i = 0; i < g.size(); i++) {
    for (size_t j = 0; j < g[i].size(); j++) {
      cout << g[i][j];
    }
    cout << endl;
  }
}
