#include <bits/stdc++.h>
using namespace std;
int n, a, b;
bool arr[1010][1010];
bool flag;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> a >> b;
  if (min(a, b) > 1) {
    cout << "NO\n";
    return 0;
  }
  if (a == b) {
    if (n == 2 or n == 3) {
      cout << "NO\n";
      return 0;
    }
    cout << "YES\n";
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) cout << (abs(i - j) == 1) ? 1 : 0;
      cout << '\n';
    }
    return 0;
  }
  if (a < b) {
    flag = true;
    swap(a, b);
  }
  for (int i = a; i < n; ++i) arr[0][i] = arr[i][0] = true;
  cout << "YES\n";
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i == j)
        cout << 0;
      else
        cout << (flag ? !arr[i][j] : arr[i][j]);
    }
    cout << '\n';
  }
  return 0;
}
