#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> a;
  vector<string> z;
  string s;
  while (cin >> s) {
    a.push_back(s);
  }
  int ans = 0;
  sort(a.begin(), a.end());
  for (int r = 0; r < 720; r++) {
    if (a[0].length() + a[5].length() == a[3].length() + 1 &&
        a[1].length() + a[4].length() == a[2].length() + 1 &&
        a[2][a[1].length() - 1] == a[3][a[0].length() - 1]) {
      if (a[0][0] == a[1][0] &&
          a[5][a[5].length() - 1] == a[4][a[4].length() - 1] &&
          a[3][0] == a[1][a[1].length() - 1] &&
          a[2][0] == a[0][a[0].length() - 1] &&
          a[2][a[2].length() - 1] == a[5][0] &&
          a[3][a[3].length() - 1] == a[4][0]) {
        string t = "";
        t = t + a[0];
        for (int i = 0; i < a[3].length() - a[0].length(); i++) {
          t = t + ".";
        }
        t = t + "\n";
        for (int i = 1; i < a[1].length() - 1; i++) {
          t = t + a[1][i];
          for (int j = 0; j < a[0].length() - 2; j++) {
            t = t + ".";
          }
          t = t + a[2][i];
          for (int j = 0; j < a[3].length() - a[0].length(); j++) {
            t = t + ".";
          }
          t = t + "\n";
        }
        t = t + a[3];
        t = t + "\n";
        for (int i = 0; i < a[2].length() - a[1].length() - 1; i++) {
          for (int j = 0; j < a[3].length() - a[5].length(); j++) {
            t = t + ".";
          }
          t = t + a[2][a[1].length() + i];
          for (int j = 0; j < a[5].length() - 2; j++) {
            t = t + ".";
          }
          t = t + a[4][i + 1];
          t = t + "\n";
        }
        for (int j = 0; j < a[3].length() - a[5].length(); j++) {
          t = t + ".";
        }
        t = t + a[5] + "\n";
        ans = 1;
        z.push_back(t);
      }
    }
    next_permutation(a.begin(), a.end());
  }
  if (ans == 0)
    cout << "Impossible" << endl;
  else {
    sort(z.begin(), z.end());
    cout << z[0] << endl;
  }
  return 0;
}
