#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  if (n == 1) {
    if (a == 1 && b == 1) {
      cout << "YES" << '\n';
      cout << 0;
      return 0;
    }
    cout << "NO";
  } else if ((n == 2 && a == 1 && b == 1) || (n == 3 && a == 1 && b == 1)) {
    cout << "NO";
  } else if (n >= 4 && a == 1 && b == 1) {
    cout << "YES" << '\n';
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (abs(i - j) == 1)
          cout << 1;
        else
          cout << 0;
      }
      cout << '\n';
    }
  } else if (min(a, b) == 1) {
    int _a = a;
    int _b = b;
    if (b > a) swap(a, b);
    cout << "YES" << '\n';
    vector<vector<int>> vec(n, vector<int>(n));
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (j <= (n - a + 1) && i <= (n - a + 1)) {
          if (i == j || (i > 1 && j != 1)) {
          } else
            vec[i - 1][j - 1] = 1;
        }
      }
    }
    if (_a < _b) {
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
          if (i == j) {
            cout << 0;
            continue;
          }
          cout << (1 - vec[i][j]);
        }
        cout << '\n';
      }
    } else {
      for (auto item : vec) {
        for (auto it : item) cout << (it);
        cout << '\n';
      }
    }
  } else {
    cout << "NO";
  }
}
