#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  if ((a != 1 && b != 1) || (a == 1 && b == 1 && (n == 3 || n == 2))) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
    int graph[n][n];
    memset(graph, 0, sizeof(graph));
    if (a == 1 && b == 1) {
      for (int i = 0; i < n - 1; i++) {
        graph[i][i + 1] = graph[i + 1][i] = 1;
      }
    } else if (a == 1) {
      for (int i = 0; i < b - 1; i++) {
        for (int j = i + 1; j < n; j++) {
          graph[i][j] = graph[j][i] = 1;
        }
      }
    } else {
      for (int i = 0; i < (n - a + 1); i++) {
        for (int j = i + 1; j < (n - a + 1); j++) {
          graph[i][j] = graph[j][i] = 1;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) cout << graph[i][j];
      cout << endl;
    }
  }
}
