#include "bits/stdc++.h" using namespace std; #define ll long long #define REP(i, n) for (int i = 0; i < n; i++) #define P pair #define ALL(n) (n).begin(), (n).end() #define INF (1ll << 60) #define chmax(a, b) a = max(a, b) void solve(ll n, ll a, ll b) { vector> ans(n, vector(n, 0)); if (a == 0 and b == 0) { ; } else if (a == n and b == 0) { REP(i, n) { REP(j, n) { if (j % 2 == 0) ans[i][j] = 1; } } } else if (a == 0 and b == n) { REP(i, n) { REP(j, n) { if (i % 2 == 0) ans[i][j] = 1; } } } else if (a == b) { REP(i, min(a, n / 2)) { ll x = 0, y = i * 2; REP(j, n / 2) { ans[x][y] = 1; x = (x + 2) % n; y = (y + 2) % n; } } a -= n / 2; REP(i, min(a, n / 2)) { ll x = 1, y = 1 + i * 2; REP(j, n / 2) { ans[x][y] = 1; x = (x + 2) % n; y = (y + 2) % n; } } } else { cout << -1 << endl; return; } REP(i, n) { REP(j, n) cout << ans[i][j]; cout << endl; } } int main() { ll T; cin >> T; REP(i, T) { ll n, a, b; cin >> n >> a >> b; solve(n, b, a); } }