#include <bits/stdc++.h>
using namespace std;
int n, a, b, x, y;
bool mat[1005][1005], imat[1005][1005], flag;
void conn(int i, int j) {
  mat[i][j] = mat[j][i] = 1;
  imat[i][j] = imat[j][i] = 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> b;
  if (a < b) {
    swap(a, b);
    flag = 1;
  }
  if (b != 1 || ((n == 2 || n == 3) && a == 1)) {
    cout << "NO\n";
    return 0;
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      if (i != j) imat[i][j] = 1;
  int i = 0, j = 1, x = n;
  while (a != x) {
    conn(i++, j++);
    x -= 1;
  }
  if (a != x) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) cout << (flag ? imat[i][j] : mat[i][j]);
    cout << endl;
  }
  return 0;
}
