#include <bits/stdc++.h>
using namespace std;
int mt[int(1e3) + 10][int(1e3) + 10];
int main() {
  std::ios::sync_with_stdio(false);
  int n, a, b;
  cin >> n >> a >> b;
  if (a == 1 && b == 1) {
    for (int i = 1; i < n; i++) {
      mt[i][i + 1] = mt[i + 1][i] = 1;
    }
    if (n == 2 || n == 3) {
      cout << "NO";
      return 0;
    }
  } else if (a == 1) {
    for (int i = 1; i < b; i++) {
      for (int j = i + 1; j <= n; j++) {
        mt[i][j] = mt[j][i] = 1;
      }
    }
  } else if (b == 1) {
    for (int i = 1; i <= n - a; i++) {
      mt[i][i + 1] = mt[i + 1][i] = 1;
    }
  } else {
    cout << "NO";
    return 0;
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) cout << mt[i][j];
    cout << endl;
  }
  return 0;
}
