#include <bits/stdc++.h>
using namespace std;
const long long M = 2e5 + 10, M2 = 1e6 + 10, oo = 1e9 + 7;
double ara[200][200], aval[200][200], bval[200][200];
vector<int> v(10, 0), res(10, 0), taken(10, 0);
vector<string> vs;
vector<int> ans;
vector<vector<string> > oss;
bool cmp(vector<string> &a, vector<string> &b) {
  long long sz = min(a.size(), b.size());
  for (int i = 0; i < sz; i++) {
    if (a[i] < b[i])
      return true;
    else if (a[i] == b[i])
      continue;
    else
      return false;
  }
  return a.size() < b.size();
}
void outit() {
  vector<string> ns;
  string s1 = vs[ans[0]], s2 = vs[ans[1]], s3 = vs[ans[2]], s4 = vs[ans[3]],
         s5 = vs[ans[4]], s6 = vs[ans[5]];
  string s = "";
  s += s1;
  long long ro = s3.length(), col = s4.length();
  for (int i = 0; i < col - s1.length(); i++) s += '.';
  ns.push_back(s);
  s = "";
  for (int i = 1; i < s2.length() - 1; i++) {
    s += s2[i];
    for (int j = 0; j < s1.length() - 2; j++) s += '.';
    s += s3[i];
    for (int j = 0; j < col - s1.length(); j++) s += '.';
    ns.push_back(s);
    s = "";
  }
  s += s4;
  ns.push_back(s);
  s = "";
  for (int i = 0; i < col - s4.length(); i++) s += '.';
  for (int i = 1; i < s5.length() - 1; i++) {
    for (int j = 0; j < s1.length() - 1; j++) s += '.';
    s += s3[s2.length() + i - 1];
    for (int j = 0; j < s6.length() - 2; j++) s += '.';
    s += s5[i];
    ns.push_back(s);
    s = "";
  }
  for (int j = 0; j < s1.length() - 1; j++) s += '.';
  s += s6;
  ns.push_back(s);
  s = "";
  oss.push_back(ns);
}
long long ok = 0;
bool test() {
  string s1 = vs[res[0]], s2 = vs[res[1]], s3 = vs[res[2]], s4 = vs[res[3]],
         s5 = vs[res[4]], s6 = vs[res[5]];
  if (not(s3.length() > s2.length() && s4.length() > s1.length() &&
          s1.length() + s6.length() == s4.length() + 1 &&
          s2.length() + s5.length() == s3.length() + 1))
    return false;
  return (s1[0] == s2[0] && s1[s1.length() - 1] == s3[0] &&
          s2[s2.length() - 1] == s4[0] &&
          s3[s2.length() - 1] == s4[s1.length() - 1] &&
          s4[s4.length() - 1] == s5[0] &&
          s5[s5.length() - 1] == s6[s6.length() - 1] &&
          s6[0] == s3[s3.length() - 1]);
}
void bct(int idx) {
  if (idx == 6) {
    if (test()) {
      ans.clear();
      for (int i = 0; i < 6; i++) {
        ans.push_back(res[i]);
      }
      outit();
    }
    return;
  }
  for (int i = 0; i <= 5; i++) {
    if (not taken[i]) {
      res[idx] = i;
      taken[i] = 1;
      bct(idx + 1);
      taken[i] = 0;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  for (int i = 0; i < 6; i++) {
    cin >> s;
    vs.push_back(s);
  }
  bct(0);
  if (ans.size() > 0) {
    sort(oss.begin(), oss.end(), cmp);
    for (int i = 0; i < oss[0].size(); i++) cout << oss[0][i] << endl;
  } else
    cout << "Impossible" << endl;
  return 0;
}
