#include <bits/stdc++.h>
using namespace std;
bool g[1001][1001];
void display(int n) {
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      printf("%d", g[i][j]);
    }
    printf("\n");
  }
}
void complement(int n) {
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (i != j) {
        g[i][j] ^= 1;
      }
    }
  }
}
void makeGraph(int n, int c) {
  assert(c <= n);
  for (int i = c + 1; i <= n; ++i) {
    g[c][i] = 1;
    g[i][c] = 1;
  }
}
void makeLineGraph(int n) {
  for (int i = 2; i <= n; ++i) {
    g[i - 1][i] = 1;
    g[i][i - 1] = 1;
  }
}
int main() {
  int n, a, b;
  scanf("%d %d %d", &n, &a, &b);
  if (n == 1) {
    assert(a == 1 and b == 1);
    cout << "YES\n";
    cout << 0;
    return 0;
  }
  if (a >= 2) {
    if (b >= 2) {
      cout << "NO\n";
    } else {
      makeGraph(n, a);
      cout << "YES\n";
      display(n);
    }
  } else {
    if (b == 1) {
      if (n <= 3) {
        cout << "NO\n";
      } else {
        makeLineGraph(n);
        cout << "YES\n";
        display(n);
      }
    } else {
      makeGraph(n, b);
      complement(n);
      cout << "YES\n";
      display(n);
    }
  }
}
