#include <bits/stdc++.h>
using namespace std;
char g[1010][1010];
int vis[1010];
int n;
void dfs(int u, char pat) {
  vis[u] = 1;
  for (int i = (1); i <= (n); ++i)
    if (!vis[i] && g[u][i] == pat) dfs(i, pat);
}
int solve(int d) {
  char pat = d ? '1' : '0';
  memset(vis, 0, sizeof(vis));
  int color = 0;
  for (int i = (1); i <= (n); ++i) {
    if (!vis[i]) dfs(i, pat), color++;
    ;
  }
  return color;
}
void gen(int num) {
  for (int i = (1); i <= (n); ++i)
    for (int j = (1); j <= (n); ++j) g[i][j] = '0';
  if (num == 0) return;
  for (int i = (2); i <= (n); ++i) {
    int x = i;
    for (int j = 1; j < (n - i + 1) + 1; j++) {
      g[x][j] = '1';
      g[j][x] = '1';
      x++;
      num--;
      if (num == 0) return;
    }
  }
}
void gen2(int num) {
  for (int i = (1); i <= (n); ++i)
    for (int j = (1); j <= (n); ++j) {
      if (i == j)
        g[i][j] = '0';
      else
        g[i][j] = '1';
    }
  if (num == 0) return;
  for (int i = (2); i <= (n); ++i) {
    int x = i;
    for (int j = 1; j < (n - i + 1) + 1; j++) {
      g[x][j] = '0';
      g[j][x] = '0';
      x++;
      num--;
      if (num == 0) return;
    }
  }
}
void output() {
  for (int i = (1); i <= (n); ++i) {
    for (int j = (1); j <= (n); ++j) cout << g[i][j];
    cout << '\n';
  }
}
int main() {
  ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(20);
  int a, b;
  cin >> n >> a >> b;
  if (a > 1 && b > 1) return 0 * puts("NO");
  if (a == 1 && b == 1 && (n == 3 || n == 2)) return 0 * puts("NO");
  cout << "YES\n";
  for (int i = (1); i <= (n); ++i)
    for (int j = (1); j <= (n); ++j) g[i][j] = '0';
  if (n == 1) return 0 * puts("0");
  int mid = n * (n - 1) / 2;
  if (a == 1 && b == 1) {
    gen(n - 1);
  } else {
    if (a > 1) {
      gen(n - a);
    } else {
      gen2(n - b);
    }
  }
  output();
  return 0;
}
