#include <bits/stdc++.h>
using namespace std;
bool shouldFlip = false;
const int maxN = 1009;
int matrix[maxN][maxN];
void addEdge(int i, int j) {
  i--;
  j--;
  matrix[i][j] = matrix[j][i] = 1;
}
void printMat(int n) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int num = matrix[i][j];
      if (shouldFlip && i != j) num = 1 - num;
      cout << num;
    }
    cout << endl;
  }
}
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) matrix[i][j] = 0;
  if (a > 1 && b > 1) {
    cout << "NO";
    return 0;
  }
  if (a == 1 && b == 1 && (n == 2 || n == 3)) {
    cout << "NO";
    return 0;
  }
  if (a == 1) {
    shouldFlip = true;
    int temp = a;
    a = b;
    b = a;
  }
  for (int i = a; i < n; i++) addEdge(i, i + 1);
  cout << "YES" << endl;
  printMat(n);
}
