#include <bits/stdc++.h>
using namespace std;
const int inf_int = 1e8;
const long long inf_ll = 1e16;
const double pi = 3.1415926535898;
bool debug = 0;
const int MAXN = 2e5 + 100;
bool A[1001][10001];
void solve() {
  int n, a, b;
  cin >> n >> a >> b;
  if (n == 2 || n == 3) {
    if (a == 1 && b == 1) {
      cout << "NO";
      return;
    }
  }
  if (a == 1) {
    cout << "YES\n";
    if (b == 1) {
      for (int i = 2; i <= n - a + 1; ++i) {
        A[i - 1][i] = A[i][i - 1] = 1;
      }
    }
    for (int i = 1; i <= b - 1; ++i) {
      for (int e = 1; e <= n; ++e) {
        if (i != e) {
          A[i][e] = A[e][i] = 1;
        }
      }
    }
  } else {
    if (b == 1) {
      cout << "YES\n";
      for (int i = 2; i <= n - a + 1; ++i) {
        A[i - 1][i] = A[i][i - 1] = 1;
      }
    } else {
      cout << "NO";
      return;
    }
  }
  for (int i = 1; i <= n; ++i) {
    string s = "";
    for (int e = 1; e <= n; ++e) {
      if (A[i][e])
        s.push_back('1');
      else
        s.push_back('0');
    }
    cout << s << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
}
