#include <bits/stdc++.h>
using namespace std;
inline int Input() {
  register int x = 0, z = 1;
  register char c = getchar();
  for (; c < '0' || c > '9'; c = getchar()) z = c == '-' ? -1 : 1;
  for (; c >= '0' && c <= '9'; c = getchar())
    x = (x << 1) + (x << 3) + (c ^ 48);
  return x * z;
}
const int maxn(1005);
int n, a, b, ans[maxn][maxn];
int main() {
  n = Input(), a = Input(), b = Input();
  if (((n == 2 || n == 3) && a == 1 && b == 1) || min(a, b) != 1)
    return puts("NO"), 0;
  puts("YES");
  register int need = max(a, b) - 1;
  for (register int i = n - need; i > 1; --i) ans[i][i - 1] = ans[i - 1][i] = 1;
  if (a < b) {
    for (register int i = 1; i <= n; ++i)
      for (register int j = 1; j <= n; ++j)
        if (i != j) ans[i][j] ^= 1;
  }
  for (register int i = 1; i <= n; ++i, puts(""))
    for (register int j = 1; j <= n; ++j) putchar(ans[i][j] + '0');
  return 0;
}
