#include <bits/stdc++.h>
using namespace std;
int mat[1007][1007];
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  int n, a, b;
  cin >> n >> a >> b;
  if (a == 1 and b == 1) {
    if (n == 2 or n == 3)
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
          if (i == j)
            cout << 0;
          else if (abs(i - j) == 1)
            cout << 1;
          else
            cout << 0;
        }
        cout << endl;
      }
    }
    return 0;
  }
  if (a != 1 and b != 1) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  int c = max(a, b);
  if (a == 1) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (i == j)
          cout << 0;
        else if (max(i, j) <= (n - c) and abs(i - j) == 1)
          cout << 0;
        else
          cout << 1;
      }
      cout << endl;
    }
  } else {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (i == j)
          cout << 0;
        else if (max(i, j) <= (n - c) and abs(i - j) == 1)
          cout << 1;
        else
          cout << 0;
      }
      cout << endl;
    }
  }
  return 0;
}
