Why this code is failing for yesterday 3Path

include <bits/stdc++.h>
using namespace std;

using ll = long long; using ull = unsigned long long; using ld = long double;
using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector; using vll = vector;

define pb push_back
define eb emplace_back
define F first
define S second
define all(x) (x).begin(), (x).end()
define rall(x) (x).rbegin(), (x).rend()
define sz(x) int((x).size())
define endl ‘\n’
define fast_io ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

define MIN(a) *min_element(all(a))
define MAX(a) *max_element(all(a))
define SUM(a) accumulate(all(a), 0LL)
define SORT(x) sort(all(x))
define RSORT(x) sort(rall(x))
define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)), v.end())

#ifdef LOCAL
define debug(x) cerr << #x << " = " << (x) << endl;
#else
define debug(x)
#endif

const int mod = 1e9 + 7;
const ll INF = 1e18;
const ld EPS = 1e-9;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

class DisjointSet {
vector rank, parent, size;
public:
DisjointSet(int n) { rank.resize(n+1); parent.resize(n+1); size.assign(n+1,1); iota(all(parent),0); }
int findUPar(int node) { return node == parent[node] ? node : parent[node] = findUPar(parent[node]); }
void unionBySize(int u, int v) {
int pu = findUPar(u), pv = findUPar(v);
if (pu == pv) return;
if (size[pu] < size[pv]) parent[pu] = pv, size[pv] += size[pu];
else parent[pv] = pu, size[pu] += size[pv];
}
};

ll binaryexpo(ll base, ll x) { ll ans=1; while(x) { if(x&1) ans=(ansbase)%mod; base=(basebase)%mod; x>>=1; } return ans; }
ll mod_exp(ll base, ll exp, ll mod) { ll res=1; while(exp) { if(exp&1) res=(resbase)%mod; base=(basebase)%mod; exp>>=1; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll mod_inv(ll a, ll m) { return mod_exp(a, m - 2, m); }

template void read(vector &a) { for (auto &x : a) cin >> x; }
template void print(vector &a) { for (auto &x : a) cout << x << ’ '; cout << endl; }
template bool in_range(T x, T l, T r) { return x >= l && x <= r; }
template void chmax(T &a, T b) { a = max(a, b); }
template void chmin(T &a, T b) { a = min(a, b); }

void solve() {
ll n;
cin >> n;

if(n <3){
    cout << -1 << endl;
    return;
}
if(n == 4){
cout << "1 1 1 1\n";
cout << "0 0 1 1\n";
cout << "0 0 1 1\n";
cout << "0 0 0 1\n";
return;

}

// Row 1: all ones
for(int i = 0; i < n; i++) cout << 1 << " ";
cout << endl;

string s(n, '0');
s[(n-1)/2] = '1';
s[n-1] = '1';

// Upper rows
for(int i = 1; i < (n-1)/2; i++){
    for(int j = 0; j < n; j++)
        cout << s[j] << " ";
    cout << endl;
}

// Middle row (ONLY ONCE)
for(int i = 0; i < (n-1)/2; i++) cout << "0 ";
for(int i = (n-1)/2; i < n; i++) cout << "1 ";
cout << endl;

// Lower rows
for(int i = 0; i +1< (n-1)/2; i++){
    for(int j = 0; j < n; j++)
        cout << s[j] << " ";
    cout << endl;
}
    for(int i = 0; i < (n-1)/2; i++) cout << "0 ";
for(int i = (n-1)/2; i < n; i++) cout << "1 ";
cout << endl;

}

int main() {
fast_io;
#ifdef LOCAL
freopen(“input.txt”, “r”, stdin);
freopen(“output.txt”, “w”, stdout);
#endif
int t = 1;
//comment for single test case
cin >> t;
while (t–) {
solve();
}
return 0;
}