#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, -1, 0};
int ans[1010][1010];
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  if (min(a, b) > 1 || (n == 2 && a == 1 && b == 1) ||
      (n == 3 && a == 1 && b == 1))
    puts("NO");
  else {
    puts("YES");
    if (a == 1) {
      for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
          if (i != j) ans[i][j] = 1;
      for (int i = 0; i < n - b; i++) ans[i][i + 1] = ans[i + 1][i] = 0;
    } else {
      for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) ans[i][j] = 0;
      for (int i = 0; i < n - a; i++) ans[i][i + 1] = ans[i + 1][i] = 1;
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) cout << ans[i][j];
      puts("");
    }
  }
  return 0;
}
