#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long double PI = 4 * atan(1);
int n, a, b, flag, X[1001][1001], Y[1001][1001];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> a >> b;
  if (a != 1 && b != 1) {
    cout << "NO";
    return 0;
  }
  if (n == 1 && a == 1 && b == 1) {
    cout << "YES\n";
    cout << 0;
    return 0;
  }
  if (n <= 3 && a == 1 && b == 1) {
    cout << "NO";
    return 0;
  }
  if (n >= 4 && a == 1 && b == 1) {
    cout << "YES\n";
    for (int i = 1; i < n + 1; i++)
      for (int j = 1; j < n + 1; j++)
        if (abs(i - j) == 1) X[i][j] = 1;
    for (int i = 1; i < n + 1; i++) {
      for (int j = 1; j < n + 1; j++) cout << X[i][j];
      cout << "\n";
    }
    return 0;
  }
  if (a < b) flag = 1, swap(a, b);
  for (int i = 1; i < (n - a + 1) + 1; i++) {
    for (int j = 1; j < (n - a + 1) + 1; j++) {
      X[i][j] = 1;
    }
  }
  for (int i = 1; i < n + 1; i++) X[i][i] = 0;
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < n + 1; j++) Y[i][j] = (1 ^ X[i][j]);
  for (int i = 1; i < n + 1; i++) Y[i][i] = 0;
  if (flag) swap(X, Y);
  cout << "YES\n";
  for (int i = 1; i < n + 1; i++) {
    for (int j = 1; j < n + 1; j++) cout << X[i][j];
    cout << "\n";
  }
  return 0;
}
