#include <bits/stdc++.h>
using namespace std;
int n, a, b, cnt = 1;
int edge[1005][1005];
int main() {
  scanf("%d%d%d", &n, &a, &b);
  if (a != 1 && b != 1) {
    puts("NO");
    return 0;
  }
  if (a != 1) {
    a--;
    while (a--) {
      for (int i = 1; i <= n; i++) edge[cnt][i] = edge[i][cnt] = 0;
      cnt++;
    }
    for (int i = cnt + 1; i <= n; i++) edge[cnt][i] = edge[i][cnt] = 1;
    puts("YES");
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) printf("%d", edge[i][j]);
      puts("");
    }
    return 0;
  }
  if (b != 1) {
    b--;
    while (b--) {
      for (int i = 1; i <= n; i++) edge[cnt][i] = edge[i][cnt] = 0;
      cnt++;
    }
    for (int i = cnt + 1; i <= n; i++) edge[cnt][i] = edge[i][cnt] = 1;
    puts("YES");
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) printf("%d", i == j ? 0 : !edge[i][j]);
      puts("");
    }
    return 0;
  }
  if (a == 1 && b == 1 && n >= 4) {
    int connect = 1;
    for (int i = 2; i <= n; i++) {
      edge[connect][i] = edge[i][connect] = 1;
      connect = i;
    }
    puts("YES");
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) printf("%d", edge[i][j]);
      puts("");
    }
    return 0;
  }
  if (a == 1 && b == 1) {
    if (n == 1)
      printf("%s\n0", "YES");
    else {
      puts("NO");
      return 0;
    };
  }
  return 0;
}
