#include <bits/stdc++.h>
using namespace std;
const int N = 1100;
int a[N][N];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, aa, b;
  cin >> n >> aa >> b;
  if (aa == 1 && b == 1 && n == 1) {
    cout << "YES" << endl << "0" << endl;
    return 0;
  }
  if ((aa > 1 && b > 1) || (aa == 1 && b == 1 && n < 4)) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  int mx = max(aa, b);
  for (int i = 0; i < n - mx; i++) a[i][i + 1] = a[i + 1][i] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j)
        cout << 0;
      else
        cout << (a[i][j] + (b > 1)) % 2;
    }
    cout << endl;
  }
  return 0;
}
