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