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