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