#include <bits/stdc++.h>
using namespace std;
bool arr[1000][1000];
void change(int n) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      arr[i][j] = !arr[i][j];
    }
  }
}
int main() {
  int n, x, y;
  int orig_x;
  cin >> n >> x >> y;
  orig_x = x;
  if (x == 1 && y == 1) {
    if (n == 2 || n == 3) {
      cout << "NO" << endl;
      return 0;
    }
    cout << "YES" << endl;
    for (int i = 0; i < n; i++) {
      arr[i][(i + 1) % n] = arr[(i + 1) % n][i] = 1;
    }
    arr[n - 1][0] = arr[0][n - 1] = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cout << arr[i][j];
      }
      cout << endl;
    }
    return 0;
  }
  if (x == 1 || y == 1) {
    if (x + y > n + 1) {
      cout << "NO" << endl;
      return 0;
    }
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
    return 0;
  }
  if (x == 1 && y == 1) {
    for (int i = 0; i < n; i++) {
      arr[i][(i + 1) % n] = 1;
      arr[(i + 1) % n][i] = 1;
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cout << arr[i][j];
      }
      cout << endl;
    }
    return 0;
  }
  int temp1 = min(x, y);
  int temp2 = max(x, y);
  x = temp1;
  y = temp2;
  int cycL = n - y + 1;
  for (int i = 0; i < cycL; i++) {
    arr[i][(i + 1) % cycL] = 1;
    arr[(i + 1) % cycL][i] = 1;
  }
  if (orig_x == 1) change(n);
  for (int i = 0; i < n; i++) {
    arr[i][i] = 0;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << arr[i][j];
    }
    cout << endl;
  }
}
