#include <bits/stdc++.h>
using namespace std;
int graph[1000][1000];
int main() {
  int n, comp1, comp2;
  scanf("%d %d %d", &n, &comp1, &comp2);
  if (comp1 > 1 && comp2 > 1) {
    printf("NO");
    return 0;
  } else if (comp1 > 1 && comp2 == 1) {
    for (int i = 0; i < n; i++) {
      for (int j = i; j < n; j++) {
        if (i == j) {
          graph[i][j] = 0;
          continue;
        }
        if (i < comp1 - 1) {
          graph[i][j] = 0;
          graph[j][i] = 0;
        } else {
          graph[i][j] = 1;
          graph[j][i] = 1;
        }
      }
    }
  } else if (comp1 == 1 && comp2 > 1) {
    for (int i = 0; i < n; i++) {
      for (int j = i; j < n; j++) {
        if (i == j) {
          graph[i][j] = 0;
          continue;
        }
        if (i < comp2 - 1) {
          graph[i][j] = 1;
          graph[j][i] = 1;
        } else {
          graph[i][j] = 0;
          graph[j][i] = 0;
        }
      }
    }
  } else {
    if (n == 2 || n == 3) {
      printf("NO");
      return 0;
    }
    for (int i = 0; i < n; i++) {
      for (int j = i; j < n; j++) {
        if (i == j) {
          graph[i][j] = 0;
          continue;
        }
        if (j == i + 1) {
          graph[i][j] = 1;
          graph[j][i] = 1;
        } else {
          graph[i][j] = 0;
          graph[j][i] = 0;
        }
      }
    }
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      printf("%d", graph[i][j]);
    }
    printf("\n");
  }
  return 0;
}
