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