#include <bits/stdc++.h>
using namespace std;
int n, a, b, m[1001][1001];
void solve() {
  cin >> n >> a >> b;
  if (a > 1 and b > 1) {
    cout << "NO" << '\n';
    return;
  }
  if (a == 1 and b == 1) {
    if (n == 1) {
      cout << "YES" << '\n';
      cout << 0;
      return;
    }
    if (n <= 3) {
      cout << "NO" << '\n';
      return;
    }
    for (int i = 1; i < n; i++) {
      m[i][i + 1] = 1;
      m[i + 1][i] = 1;
    }
    cout << "YES" << '\n';
    for (int i = 1; i < n + 1; i++) {
      for (int j = 1; j < n + 1; j++) {
        cout << m[i][j];
      }
      cout << '\n';
    }
    return;
  }
  if (a == 1) {
    for (int i = 1; i < b; i++) {
      for (int j = 1; j < n + 1; j++) {
        if (i == j) continue;
        m[i][j] = 1;
        m[j][i] = 1;
      }
    }
    cout << "YES" << '\n';
    for (int i = 1; i < n + 1; i++) {
      for (int j = 1; j < n + 1; j++) {
        cout << m[i][j];
      }
      cout << '\n';
    }
    return;
  }
  if (b == 1) {
    for (int i = a; i < n + 1; i++) {
      for (int j = a; j < n + 1; j++) {
        if (i == j) continue;
        m[i][j] = 1;
        m[j][i] = 1;
      }
    }
    cout << "YES" << '\n';
    for (int i = 1; i < n + 1; i++) {
      for (int j = 1; j < n + 1; j++) {
        cout << m[i][j];
      }
      cout << '\n';
    }
    return;
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
