#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
int ans[maxn][maxn];
int n, a, b;
void display() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cout << ans[i][j];
    }
    cout << endl;
  }
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> b;
  if (!(a == 1 || b == 1)) {
    cout << "NO" << endl;
    return 0;
  }
  if ((a == 1 && b == 1 && (n == 3 || n == 2))) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  int mx = max(a, b) - 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j)
        ans[i][j] = 0;
      else if (j == i + 1)
        ans[i][j] = ans[j][i] = 1;
    }
  }
  for (int i = 1; i <= n && mx; i++) {
    for (int j = 1; j <= n && mx; j++) {
      if (j == i + 1) ans[i][j] = ans[j][i] = 0, mx--;
    }
  }
  if (a == 1) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (i == j) continue;
        if (i > j) continue;
        ans[i][j] = 1 - ans[i][j];
        ans[j][i] = ans[i][j];
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cout << ans[i][j];
    }
    cout << endl;
  }
}
