#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e15;
vector<vector<char>> vec;
int n, a, b;
void print() {
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << vec[i][j];
    }
    cout << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> a >> b;
  vec.resize(n + 1, vector<char>(n + 1, '0'));
  if (a != 1 && b != 1) {
    return cout << "NO", 0;
  }
  if (a == 1 && b == 1) {
    if (n == 2 || n == 3) {
      return cout << "NO", 0;
    }
  }
  if (b == 1) {
    for (int i = 0; i < n - a; i++) {
      vec[i][i + 1] = '1';
      vec[i + 1][i] = '1';
    }
    print();
  } else {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (i != j) {
          vec[i][j] = '1';
        }
      }
    }
    for (int i = 0; i < n - b; i++) {
      vec[i][i + 1] = '0';
      vec[i + 1][i] = '0';
    }
    print();
  }
}
