#include <bits/stdc++.h>
using namespace std;
vector<string> dict(6);
string ans(10000000, 'Z');
void check(vector<string>& a) {
  if (a[0].length() + a[2].length() - 1 == a[4].length() &&
      a[5].length() + a[3].length() - 1 == a[1].length() &&
      a[0][0] == a[5][0] && a[0][a[0].length() - 1] == a[1][0] &&
      a[5][a[5].length() - 1] == a[4][0] &&
      a[4][a[0].length() - 1] == a[1][a[5].length() - 1] &&
      a[4][a[4].length() - 1] == a[3][0] &&
      a[2][0] == a[1][a[1].length() - 1] &&
      a[2][a[2].length() - 1] == a[3][a[3].length() - 1]) {
    string cur;
    for (int i = 0; i < a[0].length(); ++i) cur += a[0][i];
    for (int i = 0; i < a[4].length() - a[0].length(); ++i) cur += '.';
    cur += '\n';
    for (int i = 0; i < a[5].length() - 2; ++i) {
      cur += a[5][i + 1];
      for (int j = 0; j < a[4].length() - a[2].length() - 1; ++j) cur += '.';
      cur += a[1][i + 1];
      for (int j = 0; j < a[4].length() - a[0].length(); ++j) cur += '.';
      cur += '\n';
    }
    for (int i = 0; i < a[4].length(); ++i) cur += a[4][i];
    cur += '\n';
    for (int i = 0; i < a[3].length() - 2; ++i) {
      for (int j = 0; j < a[4].length() - a[2].length(); ++j) cur += '.';
      cur += a[1][a[5].length() + i];
      for (int j = 0; j < a[4].length() - a[0].length() - 1; ++j) cur += '.';
      cur += a[3][i + 1];
      cur += '\n';
    }
    for (int i = 0; i < a[4].length() - a[2].length(); ++i) cur += '.';
    for (int i = 0; i < a[2].length(); ++i) cur += a[2][i];
    ans = min(ans, cur);
  }
}
int main() {
  for (int i = 0; i < 6; ++i) cin >> dict[i];
  vector<int> used(6, 0);
  for (int i = 0; i < 6; ++i) {
    ++used[i];
    for (int i1 = 0; i1 < 6; ++i1) {
      ++used[i1];
      for (int i2 = 0; i2 < 6; ++i2) {
        ++used[i2];
        for (int i3 = 0; i3 < 6; ++i3) {
          ++used[i3];
          for (int i4 = 0; i4 < 6; ++i4) {
            ++used[i4];
            for (int i5 = 0; i5 < 6; ++i5) {
              ++used[i5];
              if (used[i] == 1 && used[i1] == 1 && used[i2] == 1 &&
                  used[i3] == 1 && used[i4] == 1 && used[i5] == 1) {
                vector<string> cur;
                cur.push_back(dict[i]), cur.push_back(dict[i1]),
                    cur.push_back(dict[i2]), cur.push_back(dict[i3]),
                    cur.push_back(dict[i4]), cur.push_back(dict[i5]);
                check(cur);
              }
              --used[i5];
            }
            --used[i4];
          }
          --used[i3];
        }
        --used[i2];
      }
      --used[i1];
    }
    --used[i];
  }
  cout << (ans == string(10000000, 'Z') ? "Impossible" : ans);
  return 0;
}
