#include <bits/stdc++.h>
using namespace std;
int n, a, b;
bool adj[1001][1001];
void no() {
  cout << "NO\n";
  exit(0);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> b;
  if (a > 1 && b > 1) {
    no();
  }
  if (n > 1 && a == 1 && b == 1) {
    if (n < 4) no();
    for (int i = 1; i < n; i++) adj[i][i + 1] = adj[i + 1][i] = 1;
    printf("YES\n");
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        printf("%d", adj[i][j]);
      }
      printf("\n");
    }
    return 0;
  } else {
    int u = a * b;
    int infirst = n - u + 1;
    for (int i = 1; i < infirst; i++) {
      adj[i][i + 1] = adj[i + 1][i] = 1;
    }
  }
  printf("YES\n");
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (b > 1)
        if (i != j) adj[i][j] = !adj[i][j];
      printf("%d", adj[i][j]);
    }
    printf("\n");
  }
  return 0;
}
