#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
using namespace std;
vector<int> par, rnk;
void make_set(int n) {
  par[n] = n;
  rnk[n] = 0;
}
int find_set(int a) {
  if (par[a] == a) return a;
  return par[a] = find_set(par[a]);
}
void union_set(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a == b) return;
  if (rnk[a] > rnk[b]) {
    par[b] = a;
  } else if (rnk[a] < rnk[b]) {
    par[a] = b;
  } else {
    par[b] = a;
    rnk[a]++;
  }
}
void solve() {
  int n, a, b;
  cin >> n >> a >> b;
  par.assign(n, 0);
  rnk.assign(n, 0);
  if (a != 1 && b != 1) {
    cout << "NO\n";
    return;
  }
  if (a == 1 && b == 1) {
    if (n == 2 || n == 3) {
      cout << "NO\n";
      return;
    }
    cout << "YES\n";
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (abs(i - j) == 1)
          cout << "1";
        else
          cout << "0";
      }
      cout << endl;
    }
    return;
  }
  for (int i = 0; i < n; i++) make_set(i);
  for (int i = 0; i < n - (max(a, b)); i++) {
    union_set(i, i + 1);
  }
  int flag = 0;
  if (a > 1) flag = 1;
  cout << "YES\n";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j)
        cout << "0";
      else if (flag) {
        if (find_set(i) == find_set(j))
          cout << "1";
        else
          cout << "0";
      } else {
        if (find_set(i) != find_set(j))
          cout << "1";
        else
          cout << "0";
      }
    }
    cout << endl;
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
