#include <bits/stdc++.h>
using namespace std;
int m[1100][1100];
int n;
void outn() {
  cout << "YES";
  for (int i = 1; i <= n; i++) {
    cout << endl;
    for (int j = 1; j <= n; j++) cout << m[i][j];
  }
}
int main() {
  int a, b;
  cin >> n >> a >> b;
  if (a > 1 && b > 1) {
    cout << "NO";
    return 0;
  }
  if (a > n || b > n) {
    cout << "NO";
    return 0;
  }
  if (n == 1 && a == 1 && b == 1) {
    cout << "YES" << endl << 0;
    return 0;
  }
  if (n <= 3 && a == 1 && b == 1) {
    cout << "NO";
    return 0;
  }
  if (a == 1 && b == 1) {
    for (int i = 1; i < n; i++) {
      m[i][i + 1] = 1;
      m[i + 1][i] = 1;
    }
    outn();
    return 0;
  }
  int x = a > 1 ? a : b;
  for (int i = x; i <= n; i++)
    for (int j = x; j <= n; j++)
      if (i != j) {
        m[i][j] = 1;
      }
  if (a == 1) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        if (i != j) {
          m[i][j] = !m[i][j];
        }
  }
  outn();
  return 0;
}
