#include <bits/stdc++.h>   using namespace std;   void solve() {}   const long long maxn = 1050;   long long n, a, b;   long long ans[maxn][maxn];   void no() {     cout <<  NO  <<   n ;     exit(0);   }   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> a >> b;     if (min(a, b) > 1) no();     if ((n == 2 or n == 3) and a == 1 and b == 1) no();     long long c = 1, d = 0;     if (b != 1) {       swap(a, b);       swap(c, d);     }     for (long long i = 1; i <= n; i++) {       ans[i][i] = 0;       for (long long j = 1; j <= n; j++) {         if (i != j) {           ans[i][j] = ans[j][i] = d;         }       }     }     for (long long i = a; i + 1 <= n; i++) {       ans[i][i + 1] = ans[i + 1][i] = c;     }     cout <<  YES  <<   n ;     for (long long i = 1; i <= n; i++) {       for (long long j = 1; j <= n; j++) {         cout << ans[i][j];       }       cout <<   n ;     }   }   