#include <bits/stdc++.h>
const long long int inf = 1e15;
const int M = 1e9 + 7;
int arr[2000][2000];
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  if (min(a, b) != 1) {
    cout << "NO\n";
    return 0;
  }
  if (a == 1 && b == 1 && n == 1) {
    cout << "YES\n0\n";
    return 0;
  }
  int save = max(a, b);
  save--;
  if (save == 0 && n < 4) {
    cout << "NO\n";
    return 0;
  }
  if (save == 0 && n >= 4) {
    for (int i = 0; i < n - 1; ++i) {
      arr[i][i + 1] = 1;
      arr[i + 1][i] = 1;
    }
  } else {
    for (int i = 0; i < n - save; ++i) {
      for (int j = 0; j < n - save; ++j) {
        arr[i][j] = 1;
      }
    }
  }
  cout << "YES\n";
  if (save + 1 == a) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        if (i != j)
          cout << arr[i][j];
        else
          cout << 0;
      }
      cout << endl;
    }
  } else {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        if (i != j) {
          if (arr[i][j] == 1)
            cout << 0;
          else
            cout << 1;
        } else
          cout << 0;
      }
      cout << endl;
    }
  }
  return 0;
}
