#include <bits/stdc++.h>
using namespace std;
const int maxn = 1050;
int s[maxn][maxn];
int main(int argc, char const *argv[]) {
  int n, a, b;
  cin >> n >> a >> b;
  if (a != 1 && b != 1) {
    printf("NO\n");
    return 0;
  }
  if (n == 1) {
    printf("YES\n0\n");
    return 0;
  }
  if (a == 1 && b == 1 && n <= 3) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  if (a == 1 && b == 1) {
    for (int i = 1; i < n; ++i) {
      s[i][i + 1] = s[i + 1][i] = 1;
    }
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        printf("%d", s[i][j]);
      }
      printf("\n");
    }
  } else if (a == 1) {
    for (int i = b; i <= n; ++i) {
      for (int j = b; j <= n; ++j) {
        s[i][j] = 1;
      }
    }
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        s[i][j] = 1 - s[i][j];
      }
      s[i][i] = 0;
    }
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        printf("%d", s[i][j]);
      }
      printf("\n");
    }
  } else {
    for (int i = a; i <= n; ++i) {
      for (int j = a; j <= n; ++j) {
        s[i][j] = 1;
      }
    }
    for (int i = 1; i <= n; ++i) s[i][i] = 0;
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        printf("%d", s[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}
