#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
constexpr auto MOD = 1000000007LL;
constexpr auto LINF = (1LL << 60);
constexpr auto INF = 2147483647LL;
constexpr auto PI = 3.1415926535897932384626433;
constexpr auto EPS = 1E-9;
template <typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2> p) {
  out << p.first << ' ' << p.second;
  return out;
}
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& p) {
  in >> p.first >> p.second;
  return in;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& v) {
  for (auto& x : v) in >> x;
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> v) {
  for (int i = 0; i < v.size(); i++)
    out << v[i] << (i + 1 == v.size() ? '\n' : ' ');
  out.flush();
  return out;
}
int n, a, b, res[1010][1010];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> a >> b;
  if (a != 1 && b != 1) {
    cout << "NO" << endl;
    return 0;
  }
  if ((n == 2 || n == 3) && a == 1 && b == 1) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  for (int i = 0, rem = n; rem > max(a, b); i++) {
    res[i][i + 1] = res[i + 1][i] = 1;
    --rem;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j)
        cout << 0;
      else
        cout << (a == 1 ? not res[i][j] : res[i][j]);
    }
    cout << endl;
  }
  return 0;
}
