#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  if (n == 1) {
    cout << "YES" << endl;
    cout << '0' << endl;
    return 0;
  }
  if (a == 1 && b != 1) {
    cout << "YES" << endl;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        if (i == j) {
          cout << '0';
        } else if (i == n - 1 && j < n - b) {
          cout << '0';
        } else if (j == n - 1 && i < n - b) {
          cout << '0';
        } else {
          cout << '1';
        }
      }
      cout << endl;
    }
  } else if (b == 1 && a != 1) {
    cout << "YES" << endl;
    for (int i = 0; i < n - a; ++i) {
      for (int j = 0; j < n - 1; ++j) {
        cout << '0';
      }
      cout << '1' << endl;
    }
    for (int i = 0; i < a - 1; ++i) {
      for (int j = 0; j < n; ++j) {
        cout << '0';
      }
      cout << endl;
    }
    for (int i = 0; i < n - a; ++i) {
      cout << '1';
    }
    for (int i = 0; i < a; ++i) {
      cout << '0';
    }
    cout << endl;
  } else if (a == 1 && b == 1) {
    if (n == 4) {
      cout << "YES" << endl;
      cout << "0100" << endl;
      cout << "1010" << endl;
      cout << "0101" << endl;
      cout << "0010" << endl;
      return 0;
    } else if (n < 5) {
      cout << "NO" << endl;
      return 0;
    }
    cout << "YES" << endl;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        if (j == (i + 1) % n || i == (j + 1) % n) {
          cout << '1';
        } else {
          cout << '0';
        }
      }
      cout << endl;
    }
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
