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