#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100005;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b;
  cin >> n >> a >> b;
  if (a != 1 && b != 1) {
    cout << "NO\n";
    return 0;
  }
  if (a > n || b > n) {
    cout << "NO\n";
    return 0;
  }
  if (a == 1 && b == 1 && (n == 2 || n == 3)) {
    cout << "NO\n";
    return 0;
  }
  if (n == 1) {
    cout << "YES\n";
    cout << "0\n";
    return 0;
  }
  cout << "YES\n";
  int flag = 0;
  if (a > b) {
    swap(a, b);
    flag = 1;
  }
  vector<vector<int> > ans(n, vector<int>(n, 1));
  for (int i = 0; i < (int)(n); ++i) {
    ans[i][i] = 0;
  }
  for (int i = 0; i < (int)(n - b); ++i) {
    ans[i][i + 1] = 0;
  }
  for (int i = 0; i < (int)(n); ++i) {
    for (int j = 0; j < (int)(n); ++j) {
      if (i == j) {
        cout << "0";
      } else {
        cout << (ans[min(i, j)][max(i, j)] ^ flag);
      }
    }
    cout << "\n";
  }
  return 0;
}
