#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e10;
const int N = 3e5 + 77;
int n, m, k, a, b;
char adj[1001][1001];
int main() {
  cin >> n >> a >> b;
  if (a > 1 and b > 1) {
    puts("NO");
    return 0;
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) adj[i][j] = '0';
  if (a == 1 and b == 1) {
    if (n == 2 or n == 3) {
      puts("NO");
      return 0;
    }
    for (int i = 1; i < n; i++) adj[i - 1][i] = adj[i][i - 1] = '1';
  } else if (a > 1) {
    a = n - a + 1;
    for (int i = 1; i < a; i++) adj[i - 1][i] = adj[i][i - 1] = '1';
  } else {
    b = n - b + 1;
    for (int i = 1; i < b; i++) adj[i - 1][i] = adj[i][i - 1] = '1';
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) {
        if (adj[i][j] == '0')
          adj[i][j] = '1';
        else
          adj[i][j] = '0';
      }
  }
  for (int i = 0; i < n; i++) adj[i][i] = '0';
  puts("YES");
  for (int i = 0; i < n; i++) cout << adj[i] << endl;
  return 0;
}
