#include <bits/stdc++.h>
using namespace std;
const int N = 2004;
int n, a, b;
bool Macierz[N][N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> a >> b;
  if ((a > 1 && b > 1)) {
    cout << "NO";
    getchar();
    getchar();
    return 0;
  }
  if (n == 2 && a == 1 && b == 1) return cout << "NO", 0;
  if (n == 3 && a == 1 && b == 1) return cout << "NO", 0;
  if (b == 1) {
    for (int i = 2; i <= n - a + 1; i++) {
      Macierz[i - 1][i] = true;
      Macierz[i][i - 1] = true;
    }
  } else {
    for (int i = 2; i <= n - b + 1; i++) {
      Macierz[i - 1][i] = true;
      Macierz[i][i - 1] = true;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (i != j) Macierz[i][j] = !Macierz[i][j];
      }
    }
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cout << Macierz[i][j];
    }
    cout << endl;
  }
  getchar();
  getchar();
  return 0;
}
