#include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > comp(1001, vector<long long>(1001, 0));
vector<bool> visited(1001, false);
long long n, a, b;
void dfs(long long idx) {
  visited[idx] = true;
  for (long long i = 1; i <= n; i++) {
    if (!visited[i] and comp[idx][i] == 1) dfs(i);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> a >> b;
  if (a > 1 and b > 1) {
    cout << "NO";
    return 0;
  }
  bool foo = false;
  if (a > b) foo = true;
  if (foo) swap(a, b);
  vector<vector<long long> > adj(n + 1, vector<long long>(n + 1, 0));
  long long todo = n - (b - 1);
  for (long long i = 2; i <= todo; i++) {
    adj[i][i - 1] = 1;
    adj[i - 1][i] = 1;
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      if (i == j) continue;
      if (!adj[i][j]) comp[i][j] = 1;
    }
  }
  visited.assign(1001, false);
  long long ct = 0;
  for (long long i = 1; i <= n; i++) {
    if (!visited[i]) {
      ct++;
      dfs(i);
    }
  }
  if (ct != a) {
    cout << "NO";
    return 0;
  }
  cout << "YES"
       << "\n";
  if (foo) {
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= n; j++) {
        cout << adj[i][j];
      }
      cout << "\n";
    }
  } else {
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= n; j++) {
        cout << comp[i][j];
      }
      cout << "\n";
    }
  }
  return 0;
}
