#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll INF = ll(1e18);
const int inf = 0x3f3f3f3f;
const int N = 1005;
int n, a, b;
bool adjm[N][N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> a >> b;
  if (min(a, b) > 1 || (n == 2 && a == 1 && b == 1) ||
      (n == 3 && a == 1 && b == 1)) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
    for (int i = 1; i <= n - max(a, b); i++)
      adjm[i][i + 1] = adjm[i + 1][i] = 1;
    if (a > b) {
      for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) cout << adjm[i][j];
        cout << endl;
      }
    } else {
      for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) cout << (i != j ? !adjm[i][j] : 0);
        cout << endl;
      }
    }
  }
  return 0;
}
