#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  if (a > 1 && b > 1) {
    cout << "NO\n";
    return 0;
  }
  if (a == 1 && b == 1) {
    if (n == 1) {
      cout << "YES\n0\n";
    } else if (n == 2 || n == 3) {
      cout << "NO\n";
    } else {
      vector<string> arr(n + 1, string(n + 1, '0'));
      for (int i = 1; i <= n - 1; ++i) {
        arr[i][i + 1] = arr[i + 1][i] = '1';
      }
      cout << "YES\n";
      for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
          cout << arr[i][j];
        }
        cout << '\n';
      }
    }
    return 0;
  }
  bool swapped = false;
  if (a == 1) {
    swapped = true;
    swap(a, b);
  }
  vector<string> arr(n + 1, string(n + 1, '0'));
  int cc = n;
  int pos = 2;
  while (cc > a) {
    arr[1][pos] = arr[pos][1] = '1';
    pos++;
    cc--;
  }
  if (swapped) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        if (i == j) continue;
        if (arr[i][j] == '0')
          arr[i][j] = '1';
        else
          arr[i][j] = '0';
      }
    }
  }
  cout << "YES\n";
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cout << arr[i][j];
    }
    cout << '\n';
  }
  return 0;
}
