#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 9;
const long long mod = 1e9 + 7;
vector<bool> prime(MAX, 1);
vector<int> spf(MAX, 1), primes;
void sieve() {
  prime[0] = prime[1] = 0;
  spf[2] = 2;
  for (long long i = 4; i < MAX; i += 2) {
    spf[i] = 2;
    prime[i] = 0;
  }
  primes.push_back(2);
  for (long long i = 3; i < MAX; i += 2) {
    if (prime[i]) {
      primes.push_back(i);
      spf[i] = i;
      for (long long j = i * i; j < MAX; j += i) {
        prime[j] = 0;
        if (spf[j] == 1) {
          spf[j] = i;
        }
      }
    }
  }
}
template <typename T>
void in(T &x) {
  cin >> x;
}
template <typename T, typename U>
void in(T &x, U &y) {
  cin >> x >> y;
}
template <typename T, typename U, typename V>
void in(T &x, U &y, V &z) {
  cin >> x >> y >> z;
}
template <typename T>
void ps(T x) {
  cout << x << " ";
}
template <typename T>
void ps(const vector<T> &x, int n) {
  for (int i = 0; i < n; i++) {
    cout << x[i];
    (i == n - 1) ? cout << '\n' : cout << " ";
  }
}
template <typename T>
void pl(T x) {
  cout << x << '\n';
}
template <typename T>
void pl(const vector<T> &x, int n) {
  for (int i = 0; i < n; i++) {
    cout << x[i] << "\n";
  }
}
template <typename T>
T power(T a, T b) {
  T res = 1;
  while (b) {
    if (b & 1) {
      res = res * a;
    }
    a = a * a;
    b = b >> 1;
  }
  return res;
}
template <typename T>
T power(T a, T b, T m) {
  T res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a) % m;
    }
    a = (a * a) % m;
    b = b >> 1;
  }
  return res % m;
}
void virtual_main() {}
void real_main() {
  int n, a, b;
  in(n, a, b);
  if (min(a, b) > 1) {
    cout << "NO\n";
    return;
  }
  if (a == 1 && b == 1 && (n == 2 || n == 3)) {
    cout << "NO\n";
    return;
  }
  vector<vector<int> > dp(n + 1, vector<int>(n + 1, 0));
  cout << "YES\n";
  if (a >= b) {
    for (int i = a; i < n; i++) {
      dp[i][i + 1] = 1;
      dp[i + 1][i] = 1;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        cout << dp[i][j];
      }
      cout << '\n';
    }
  } else {
    for (int i = b; i < n; i++) {
      dp[i][i + 1] = 1;
      dp[i + 1][i] = 1;
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (i != j) dp[i][j] = (dp[i][j] ^ 1);
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        cout << dp[i][j];
      }
      cout << '\n';
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  virtual_main();
  int test_cases = 1;
  for (int i = 1; i <= test_cases; i++) {
    real_main();
  }
  return 0;
}
