#include <bits/stdc++.h>
using namespace std;
void init_ios() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
const int N = 1010;
int n, a, b, g[N][N];
vector<int> child[N];
void build() {
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < child[i].size(); ++j) g[i][child[i][j]] = 1;
}
int main() {
  init_ios();
  cin >> n >> a >> b;
  if (min(a, b) > 1) {
    cout << "NO\n";
    return 0;
  }
  if (a == b && a == 1 && (n == 2 || n == 3)) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  int mx = max(a, b);
  for (int i = mx; i < n; ++i) {
    child[i].push_back(i + 1);
    child[i + 1].push_back(i);
  }
  build();
  if (a == 1)
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= n; ++j)
        if (i != j) g[i][j] = 1 - g[i][j];
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) cout << g[i][j];
    cout << "\n";
  }
}
