#include <bits/stdc++.h>
using namespace std;
string s[6];
short len[6];
int main() {
  for (int i = 0; i < 6; i++) cin >> s[i];
  sort(s, s + 6);
  vector<string> r;
  r.clear();
  do {
    if (s[0].length() + s[2].length() - 1 == s[1].length() &&
        s[3].length() + s[5].length() - 1 == s[4].length()) {
      for (int i = 0; i < 6; i++) len[i] = s[i].length();
      if (s[0][0] == s[3][0] && s[1][0] == s[3][len[3] - 1] &&
          s[0][len[0] - 1] == s[4][0] && s[1][len[0] - 1] == s[4][len[3] - 1] &&
          s[1][len[1] - 1] == s[5][0] && s[4][len[4] - 1] == s[2][0] &&
          s[2][len[2] - 1] == s[5][len[5] - 1]) {
        vector<string> w(len[4], string(len[1], '.'));
        ;
        for (int i = 0; i < len[0]; i++) w[0][i] = s[0][i];
        for (int i = 0; i < len[1]; i++) w[len[3] - 1][i] = s[1][i];
        for (int i = 0; i < len[2]; i++)
          w[len[4] - 1][i + len[0] - 1] = s[2][i];
        for (int i = 0; i < len[3]; i++) w[i][0] = s[3][i];
        for (int i = 0; i < len[4]; i++) w[i][len[0] - 1] = s[4][i];
        for (int i = 0; i < len[5]; i++)
          w[i + len[3] - 1][len[1] - 1] = s[5][i];
        if (r.size() == 0 || r > w) r = w;
      }
    }
  } while (next_permutation(s, s + 6));
  if (r.size() == 0)
    cout << "Impossible" << endl;
  else
    for (int i = 0; i < r.size(); i++) {
      cout << r[i];
      cout << endl;
    }
  return 0;
}
