#include <bits/stdc++.h>
using namespace std;
int n, a, b, t[1005][1005];
int main() {
  cin >> n >> a >> b;
  if (a > 1 && b > 1) {
    cout << "NO";
    return 0;
  }
  if (b == 1 && a == 1 && (n == 2 || n == 3)) {
    cout << "NO";
    return 0;
  }
  cout << "YES\n";
  int k = n - max(a, b) + 1;
  for (int i = 1; i < k; i++) {
    t[i][i + 1] = 1;
    t[i + 1][i] = 1;
  }
  if (b > 1) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        if (i != j) t[i][j] = 1 - t[i][j];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) cout << t[i][j];
    cout << "\n";
  }
  return 0;
}
