#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, g[N][N], a, b;
void generate(int num) {
  for (int i = num + 1; i <= n; ++i) g[num][i] = g[i][num] = 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> b;
  if (a > 1 && b > 1) {
    cout << "NO\n";
    return 0;
  }
  bool check = true;
  if (a > 1)
    generate(a);
  else if (a == 1 && b > 1) {
    generate(b);
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= n; ++j)
        if (i != j) {
          if (g[i][j] == 1)
            g[i][j] = 0;
          else
            g[i][j] = 1;
        }
  } else {
    if (n == 1)
      ;
    else if (n <= 3)
      check = false;
    else {
      for (int i = 1; i <= n - 1; ++i) g[i][i + 1] = g[i + 1][i] = 1;
    }
  }
  if (!check)
    cout << "NO\n";
  else {
    cout << "YES\n";
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) cout << g[i][j];
      cout << "\n";
    }
  }
  return 0;
}
