Language: C++

#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define int long long
#define ll long long
#define ins insert
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ff first
#define ss second
#define ld long double
#define rsz resize
#define pii pair<int, int>

using namespace std;

mt19937 rnd(time(nullptr));

const long long INF = 1e18;
vector<vector<string> > kek = {{}, {}, {}, {"aa.", "..a", "..a"}, {"aacd", "bbcd", "cdaa", "cdbb"}, {"aabbc", "dcc.c", "d..bd", "c..bd", "cbbaa"}, {"abcc..", "ab..dd", "bacc..", "ba..dd", "cdaa..", "cd..bb"}, {".aabb.c", "..cc.ac", "dd...ad", "b....bd", "b....bc", "a...aac", "addcc.."}};

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    char a[n][n];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            a[i][j] = '.';
        }
    }
    if (n == 2) {
        cout << -1;
        return 0;
    }
    if (n == 3) {
        for (auto elem : kek[3]) {
            cout << elem  << "\n";
        }
        return 0;
    }
    int x = (n / 4) - 1, y = n - x * 4;
    for (int q = 0; q < x; q++) {
        for (int i = 4 * q; i < 4 + 4 * q; i++) {
            for (int j = 4 * q; j < 4 * (q + 1); j++) {
                a[i][j] = kek[4][i - 4 * q][j - q * 4];
            }
        }
    }
    for (int i = x * 4; i < n; i++) {
        for (int j = x * 4; j < n; j++) {
            a[i][j] = kek[y][i - x * 4][j - x * 4];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << a[i][j];
        }
        cout << "\n";
    }
    return 0;
}
#include <bits/stdc++.h>

#define all(x) x.begin(), x.end()
#define int long long
#define ll long long
#define ins insert
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ff first
#define ss second
#define ld long double
#define rsz resize
#define pii pair<int, int>

using namespace std;

mt19937 rnd(time(nullptr));

const long long INF = 1e18;
vector<vector<string> > kek = {{}, {}, {}, {"aa.", "..a", "..a"}, {"aacd", "bbcd", "cdaa", "cdbb"}, {"aabbc", "dcc.c", "d..bd", "c..bd", "cbbaa"}, {"abcc..", "ab..dd", "bacc..", "ba..dd", "cdaa..", "cd..bb"}, {".aabb.c", "..cc.ac", "dd...ad", "b....bd", "b....bc", "a...aac", "addcc.."}};

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    char a[n][n];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            a[i][j] = '.';
        }
    }
    if (n == 2) {
        cout << -1;
        return 0;
    }
    if (n == 3) {
        for (auto elem : kek[3]) {
            cout << elem  << "\n";
        }
        return 0;
    }
    int x = (n / 4) - 1, y = n - x * 4;
    for (int q = 0; q < x; q++) {
        for (int i = 4 * q; i < 4 + 4 * q; i++) {
            for (int j = 4 * q; j < 4 * (q + 1); j++) {
                a[i][j] = kek[4][i - 4 * q][j - q * 4];
            }
        }
    }
    for (int i = x * 4; i < n; i++) {
        for (int j = x * 4; j < n; j++) {
            a[i][j] = kek[y][i - x * 4][j - x * 4];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << a[i][j];
        }
        cout << "\n";
    }
    return 0;
}


Compiler output:
a.cc:87:9: error: redefinition of 'std::mt19937 rnd'
   87 | mt19937 rnd(time(nullptr));
      |         ^~~
a.cc:19:9: note: 'std::mt19937 rnd' previously declared here
   19 | mt19937 rnd(time(nullptr));
      |         ^~~
a.cc:89:17: error: redefinition of 'const long long int INF'
   89 | const long long INF = 1e18;
      |                 ^~~
a.cc:21:17: note: 'const long long int INF' previously defined here
   21 | const long long INF = 1e18;
      |                 ^~~
a.cc:90:25: error: redefinition of 'std::vector<std::vector<std::__cxx11::basic_string<char> > > kek'
   90 | vector<vector<string> > kek = {{}, {}, {}, {"aa.", "..a", "..a"}, {"aacd", "bbcd", "cdaa", "cdbb"}, {"aabbc", "dcc.c", "d..bd", "c..bd", "cbbaa"}, {"abcc..", "ab..dd", "bacc..", "ba..dd", "cdaa..", "cd..bb"}, {".aabb.c", "..cc.ac", "dd...ad", "b....bd", "b....bc", "a...aac", "addcc.."}};
      |                         ^~~
a.cc:22:25: note: 'std::vector<std::vector<std::__cxx11::basic_string<char> > > kek' previously declared here
   22 | vector<vector<string> > kek = {{}, {}, {}, {"aa.", "..a", "..a"}, {"aacd", "bbcd", "cdaa", "cdbb"}, {"aabbc", "dcc.c", "d..bd", "c..bd", "cbbaa"}, {"abcc..", "ab..dd", "bacc..", "ba..dd", "cdaa..", "cd..bb"}, {".aabb.c", "..cc.ac", "dd...ad", "b....bd", "b....bc", "a...aac", "addcc.."}};
      |                         ^~~
a.cc:92:9: error: redefinition of 'int32_t main()'
   92 | int32_t main() {
      |         ^~~~
a.cc:24:9: note: 'int32_t main()' previously defined here
   24 | int32_t main() {
      |         ^~~~