#include <bits/stdc++.h>
using namespace std;
const long long int N = ((long long int)1e3) + 5;
const long long int M = ((long long int)1e3) + 5;
const long long int llinf = (long long int)1e18;
const int inf = INT_MAX;
long long int n, a, b;
long long int ilovelofimusic;
bool g[N][N];
void bagla(long long int x, long long int y) {
  g[x][y] = true;
  g[y][x] = true;
}
void hepsiylenbagla(int x) {
  for (int i = 1; i <= n; i++)
    if (i != x) bagla(i, x);
}
void matYazdirTersten() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j) {
        cout << "0";
        continue;
      }
      cout << !g[i][j];
    }
    cout << "\n";
  }
}
void matYazdir() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cout << g[i][j];
    }
    cout << "\n";
  }
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> n >> a >> b;
  if (a != 1 && b != 1) return cout << "NO\n", 0;
  if (n == 1 && b == 1 && a == 1) return cout << "YES\n0\n", 0;
  if (a == b) {
    if (n < 4) return cout << "NO\n", 0;
    cout << "YES\n";
    for (int i = 1; i < n; i++) bagla(i, i + 1);
    matYazdir();
    return 0;
  }
  ilovelofimusic = max(a, b);
  for (int i = 1; i <= ilovelofimusic - 1; i++) {
    hepsiylenbagla(i);
  }
  cout << "YES\n";
  if (a == 1)
    matYazdir();
  else
    matYazdirTersten();
}
