#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  if (n == 2) {
    if (a == 1 && b == 2) {
      cout << "YES\n01\n10\n";
    } else if (a == 2 && b == 1) {
      cout << "YES\n00\n00\n";
    } else {
      cout << "NO\n";
    }
    return 0;
  }
  if (a != 1 && b != 1 || (n == 3 && a == 1 && b == 1)) {
    cout << "NO\n";
    return 0;
  }
  const bool val = a == 1;
  if (a > b) {
    swap(a, b);
  }
  cout << "YES\n";
  vector<vector<bool>> matrix(n, vector<bool>(n));
  if (a == b) {
    for (int i = 0; i < n - 1; ++i) {
      matrix[i][i + 1] = matrix[i + 1][i] = 1;
    }
  } else {
    for (int i = 0; i < n; ++i) {
      for (int j = i + 1; j < n; ++j) {
        matrix[i][j] = matrix[j][i] = !val;
      }
    }
    for (int i = 0; i < b - 1; ++i) {
      for (int j = i + 1; j < n; ++j) {
        matrix[i][j] = matrix[j][i] = val;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cout << matrix[i][j];
    }
    cout << '\n';
  }
  return 0;
}
