#include <bits/stdc++.h>
using namespace std;
const int N = 1002;
int n, a, b, ans[N][N];
bool is;
int main() {
  cin >> n >> a >> b;
  if (a == 1 && b == 1 && n == 1) {
    cout << "YES" << endl << 0 << endl;
    return 0;
  }
  if (a > 1 && b > 1 || a == 1 && b == 1 && n <= 3) {
    cout << "NO" << endl;
    return 0;
  }
  if (a == 1 && b == 1) {
    for (int i = 1; i < n; i++) ans[i][i + 1] = ans[i + 1][i] = 1;
  } else {
    if (a == 1) swap(a, b), is = 1;
    a = n - a + 1;
    for (int i = 1; i <= a; i++)
      for (int j = 1; j <= a; j++)
        if (i != j) ans[i][j] = 1;
    if (is)
      for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
          if (i != j) ans[i][j] ^= 1;
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < n; j++) printf("%d", ans[i][j]);
    printf("%d\n", ans[i][n]);
  }
  return 0;
}
