#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007LL;
const long long int big = 2.19e15 + 1;
const long double pai = 3.141592653589793238462643383279502884197;
const long double eps = 1e-15;
template <class T, class U>
void mineq(T& a, U b) {
  if (a > b) {
    a = b;
  }
}
template <class T, class U>
void maxeq(T& a, U b) {
  if (a < b) {
    a = b;
  }
}
long long int gcd(long long int a, long long int b) {
  if (a % b == 0) {
    return b;
  } else
    return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return a / gcd(a, b) * b;
}
template <class T>
void SO(T& ve) {
  sort(ve.begin(), ve.end());
}
template <class T>
void REV(T& ve) {
  reverse(ve.begin(), ve.end());
}
long long int LBI(vector<int>& ar, int in) {
  return lower_bound(ar.begin(), ar.end(), in) - ar.begin();
}
long long int UBI(vector<int>& ar, int in) {
  return upper_bound(ar.begin(), ar.end(), in) - ar.begin();
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  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) {
    cout << "NO" << endl;
    return 0;
  }
  if (n == 2) {
    if (a == 1 && b == 2) {
      cout << "YES" << endl;
      cout << "01" << endl;
      cout << "10" << endl;
    }
    if (a == 2 && b == 1) {
      cout << "YES" << endl;
      cout << "00" << endl;
      cout << "00" << endl;
    }
    if (a == 1 && b == 1) {
      cout << "NO" << endl;
    }
    return 0;
  }
  if (n == 3 && a == 1 && b == 1) {
    cout << "NO" << endl;
    return 0;
  }
  if (a == 1 && b == 1) {
    cout << "YES" << endl;
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        if (abs(i - j) == 1) {
          cout << 1;
        } else {
          cout << 0;
        }
      }
      cout << endl;
    }
    return 0;
  }
  cout << "YES" << endl;
  if (a == 1) {
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        if (i != j && (i + 1 < b || j + 1 < b)) {
          cout << 1;
        } else {
          cout << 0;
        }
      }
      cout << endl;
    }
  }
  if (b == 1) {
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        if (i == j || (i + 1 < a || j + 1 < a)) {
          cout << 0;
        } else {
          cout << 1;
        }
      }
      cout << endl;
    }
  }
  return 0;
}
