func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const double err = 1e-12;   const double PI = 3.141592653589793;   const int N = 1e5 + 5;   vector<string> V(6);   vector<bool> used(6, false);   vector<string> res(6);   vector<string> bres;   bool f = false;   void bt(int lvl) {     if (lvl == 0) {       for (int i = 0; i < 6; i++) {         for (int j = 0; j < 6; j++) {           if (i != j && V[i].front() == V[j].front()) {             res[0] = V[i];             res[1] = V[j];             used[i] = 1;             used[j] = 1;             bt(lvl + 1);             used[i] = 0;             used[j] = 0;           }         }       }     }     if (lvl == 1) {       for (int i = 0; i < 6; i++) {         if (!used[i] && V[i].front() == res[0].back()) {           res[2] = V[i];           used[i] = 1;           bt(lvl + 1);           used[i] = 0;         }       }     }     if (lvl == 2) {       for (int i = 0; i < 6; i++) {         if (!used[i] && V[i].front() == res[1].back() &&             V[i].length() >= res[0].length() &&             res[2].length() >= res[1].length() &&             V[i][res[0].length() - 1] == res[2][res[1].length() - 1]) {           res[3] = V[i];           used[i] = 1;           bt(lvl + 1);           used[i] = 0;         }       }     }     if (lvl == 3) {       for (int i = 0; i < 6; i++) {         if (!used[i] && V[i].front() == res[3].back() &&             V[i].length() == (res[2].length() - res[1].length() + 1)) {           res[4] = V[i];           used[i] = 1;           bt(lvl + 1);           used[i] = 0;         }       }     }     if (lvl == 4) {       for (int i = 0; i < 6; i++) {         if (!used[i] && V[i].front() == res[2].back() &&             V[i].back() == res[4].back()) {           if (V[i].length() == (res[3].length() - res[0].length() + 1)) {             res[5] = V[i];             used[i] = 1;             bt(lvl + 1);             used[i] = 0;           }         }       }     }     if (lvl == 5) {       vector<string> out(res[2].length(), string(res[3].length(),  . ));       for (int i = 0; i < res[0].length(); i++) out[0][i] = res[0][i];       for (int i = 0; i < res[1].length(); i++) out[i][0] = res[1][i];       for (int i = 0; i < res[2].length(); i++)         out[i][res[0].length() - 1] = res[2][i];       for (int i = 0; i < res[3].length(); i++)         out[res[1].length() - 1][i] = res[3][i];       for (int i = 0; i < res[4].length(); i++)         out[i + res[1].length() - 1][res[3].length() - 1] = res[4][i];       for (int i = 0; i < res[5].length(); i++)         out[res[2].length() - 1][i + res[0].length() - 1] = res[5][i];       if (bres.empty())         bres = out;       else {         bool f = false;         for (int i = 0; i < min(bres.size(), out.size()); i++) {           if (bres[i] > out[i]) {             f = true;             bres = out;             break;           } else if (out[i] > bres[i]) {             f = true;             break;           }         }         if (!f) {           if (bres.size() > out.size()) bres = out;         }       }     }   }   void solve() {     for (int i = 0; i < 6; i++) cin >> V[i];     bt(0);     if (bres.empty())       cout <<  Impossible n ;     else {       for (auto i : bres) cout << i <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t = 1;     while (t--) solve();     return 0;   }   