func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   T inline sqr(T x) {     return x * x;   }   const int mlen = 303;   int p[6];   char s[6][mlen];   char res[mlen][mlen];   vector<vector<string> > x;   void draw(int sx, int sy, const char *s, int dx, int dy) {     while (*s) res[sy][sx] = *s++, sx += dx, sy += dy;   }   int main() {     for (int i = 0; i < (int)(6); i++) gets(s[i]), p[i] = i;     do {       int H = strlen(s[p[0]]) - 1;       int W = strlen(s[p[1]]) - 1;       int h = strlen(s[p[2]]) - 1;       int w = strlen(s[p[3]]) - 1;       int bad = 0;       bad |= (strlen(s[p[0]]) != strlen(s[p[2]]) + strlen(s[p[4]]) - 1);       bad |= (strlen(s[p[1]]) != strlen(s[p[3]]) + strlen(s[p[5]]) - 1);       bad |= (s[p[0]][0] != s[p[3]][w]);       bad |= (s[p[0]][h] != s[p[1]][w]);       bad |= (s[p[0]][H] != s[p[5]][0]);       bad |= (s[p[2]][0] != s[p[3]][0]);       bad |= (s[p[2]][h] != s[p[1]][0]);       bad |= (s[p[4]][0] != s[p[1]][W]);       bad |= (s[p[4]][H - h] != s[p[5]][W - w]);       if (bad) continue;       memset(res,  . , sizeof(res));       draw(0, 0, s[p[2]], 0, 1);       draw(w, 0, s[p[0]], 0, 1);       draw(W, h, s[p[4]], 0, 1);       draw(0, 0, s[p[3]], 1, 0);       draw(0, h, s[p[1]], 1, 0);       draw(w, H, s[p[5]], 1, 0);       vector<string> R;       for (int i = 0; i < (int)(H + 1); i++)         res[i][W + 1] = 0, R.push_back(res[i]);       x.push_back(R);     } while (next_permutation(p, p + 6));     sort((x).begin(), (x).end());     if (!x.size())       puts( Impossible );     else {       for (int i = 0; i < (int)(x[0].size()); i++) {         for (int j = 0; j < (int)(x[0][0].size()); j++) printf( %c , x[0][i][j]);         puts(  );       }     }     return 0;   }   