func_code_string: #include <bits/stdc++.h>   using namespace std;   int x[5], y[5];   int matr[5005][5005];   inline void err() {     for (int i = 0; i <= 5000; ++i)       for (int j = 0; j <= 5000; ++j) matr[i][j] = -1;   }   inline void fil(int i, int j, int ii, int jj, int val) {     for (int a = i; a <= ii; ++a)       for (int b = j; b <= jj; ++b) matr[a][b] = val;   }   int main() {     ios ::sync_with_stdio(false);     int a, b, c, d, e, f;     cin >> a >> b >> c >> d >> e >> f;     int S = a * b + c * d + e * f;     int rad = (int)sqrt((double)S);     if (rad * rad != S) {       cout << -1;       exit(0);     }     x[0] = a;     y[0] = b;     x[1] = c;     y[1] = d;     x[2] = e;     y[2] = f;     int lim = 1 << 3;     lim--;     for (int i = 0; i <= lim; ++i) {       for (int j = 0; j <= 3; ++j)         if (i & (1 << j)) swap(x[j], y[j]);       err();       for (int masca = 0; masca <= lim; ++masca) {         if (__builtin_popcount(masca) < 2) continue;         int xx1 = 0;         int m = 0;         m ^= 1;         m ^= 2;         m ^= 4;         int ymax = 0;         int ymin = 1 << 30;         int tx = 0;         int ty = 0;         for (int j = 0; j <= 2; ++j)           if (masca & (1 << j)) {             xx1 += x[j];             m ^= (1 << j);             ymax = max(ymax, y[j]);             ymin = min(ymin, y[j]);           } else {             tx = x[j];             ty = y[j];           }         if (ty != ymax - ymin and ty != rad - ymax) continue;         if (xx1 == rad) {           err();           int lastx = 1;           int lasty = 1;           for (int j = 0; j <= 3; ++j)             if (masca & (1 << j)) {               fil(lastx, lasty, lastx + x[j] - 1, lasty + y[j] - 1, j);               lastx = lastx + x[j];               lasty = 1;             }           int muie = -1;           while (m) {             ++muie;             m >>= 1;           }           cout << rad <<   n ;           for (int i = 1; i <= rad; ++i) {             for (int j = 1; j <= rad; ++j) {               if (matr[i][j] == -1) matr[i][j] = muie;               cout << (char)(matr[i][j] +  A );             }             cout <<   n ;           }           exit(0);         }       }       for (int j = 0; j <= 3; ++j)         if (i & (1 << j)) swap(x[j], y[j]);     }     cout << -1;     exit(0);     return 0;   }   