#include <bits/stdc++.h>
using namespace std;
void f1();
void f2();
void f3();
void f4();
void f5();
vector<string> ans(6);
vector<string> v;
vector<string> aline(31);
int f[6];
void f1() {
  for (int i = 0; i < (int)6; ++i) {
    if (f[i] == 1) continue;
    if (v[i][0] == ans[0][0]) {
      ans[1] = v[i];
      f[i] = 1;
      f2();
      f[i] = 0;
    }
  }
}
void f2() {
  for (int i = 0; i < (int)6; ++i) {
    if (f[i] == 1) continue;
    if (v[i][0] == ans[0][ans[0].length() - 1]) {
      ans[2] = v[i];
      f[i] = 1;
      f3();
      f[i] = 0;
    }
  }
}
void f3() {
  int len0 = ans[0].length();
  int len1 = ans[1].length();
  for (int i = 0; i < (int)6; ++i) {
    if (f[i] == 1) continue;
    if (v[i][0] == ans[1][len1 - 1] && v[i][len0 - 1] == ans[2][len1 - 1]) {
      ans[3] = v[i];
      f[i] = 1;
      f4();
      f[i] = 0;
    }
  }
}
void f4() {
  int len2 = ans[2].length();
  for (int i = 0; i < (int)6; ++i) {
    if (f[i] == 1) continue;
    if (v[i][0] == ans[2][len2 - 1]) {
      ans[4] = v[i];
      f[i] = 1;
      f5();
      f[i] = 0;
    }
  }
}
void f5() {
  int len3 = ans[3].length();
  int len4 = ans[4].length();
  for (int i = 0; i < (int)6; ++i) {
    if (f[i] == 1) continue;
    if (v[i][0] == ans[3][len3 - 1] &&
        v[i][v[i].length() - 1] == ans[4][len4 - 1]) {
      ans[5] = v[i];
      if (ans[0].length() + ans[4].length() == ans[3].length() + 1 &&
          ans[1].length() + ans[5].length() == ans[2].length() + 1) {
        vector<string> line(31);
        int w = ans[3].length();
        int h = ans[2].length();
        line[0] = ans[0];
        for (int i = 0; i < (int)w - ans[0].length(); ++i) line[0] += ".";
        for (int i = 0; i < (int)ans[1].length() - 2; ++i) {
          line[i + 1] = ans[1][i + 1];
          for (int j = 0; j < (int)ans[0].length() - 2; ++j) line[i + 1] += ".";
          line[i + 1] += ans[2][i + 1];
          for (int j = 0; j < (int)w - ans[0].length(); ++j) line[i + 1] += ".";
        }
        line[ans[1].length() - 1] = ans[3];
        for (int i = 0; i < (int)ans[5].length() - 2; ++i) {
          line[ans[1].length() + i] = "";
          for (int j = 0; j < (int)ans[0].length() - 1; ++j)
            line[ans[1].length() + i] += ".";
          line[ans[1].length() + i] += ans[2][i + ans[1].length()];
          for (int j = 0; j < (int)w - ans[0].length() - 1; ++j)
            line[ans[1].length() + i] += ".";
          line[ans[1].length() + i] += ans[5][i + 1];
        }
        line[ans[2].length() - 1] = "";
        for (int i = 0; i < (int)ans[0].length() - 1; ++i)
          line[ans[2].length() - 1] += ".";
        line[ans[2].length() - 1] += ans[4];
        if (aline > line) aline = line;
      }
    }
  }
}
int main() {
  v.clear();
  for (int i = 0; i < (int)6; ++i) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  memset(f, 0, sizeof(f));
  aline[0] = "ZZZZZZZZZZZZZZZ";
  for (int i = 0; i < (int)6; ++i) {
    ans[0] = v[i];
    f[i] = 1;
    f1();
    f[i] = 0;
  }
  if (aline[0] == "ZZZZZZZZZZZZZZZ") {
    cout << "Impossible" << endl;
    return 0;
  }
  for (int i = 0; aline[i] != ""; i++) cout << aline[i] << endl;
}
