#include <bits/stdc++.h>
using namespace std;
bool mf(vector<string> p1, vector<string> p2) {
  for (int i = 0; i < min(int(p1.size()), int(p2.size())); i++) {
    if (p1[i] == p2[i]) continue;
    return (p1[i] < p2[i]);
  }
  return p1.size() < p2.size();
}
int main() {
  vector<int> p(6);
  vector<string> s(6);
  for (int i = 0; i < 6; i++) {
    cin >> s[i];
    p[i] = i;
  }
  vector<vector<string> > anw;
  do {
    if (int(s[p[0]].size()) + int(s[p[5]].size()) - 1 != int(s[p[3]].size()))
      continue;
    if (int(s[p[1]].size()) + int(s[p[4]].size()) - 1 != int(s[p[2]].size()))
      continue;
    if (s[p[0]][0] != s[p[1]][0]) continue;
    if (s[p[0]].back() != s[p[2]][0]) continue;
    if (s[p[1]].back() != s[p[3]][0]) continue;
    if (s[p[3]].back() != s[p[4]][0]) continue;
    if (s[p[2]].back() != s[p[5]][0]) continue;
    if (s[p[5]].back() != s[p[4]].back()) continue;
    if (s[p[3]][int(s[p[0]].size()) - 1] != s[p[2]][int(s[p[1]].size()) - 1])
      continue;
    vector<string> d;
    string a = "";
    for (int i = 0; i < int(s[p[3]].size()); i++) a += '.';
    for (int i = 0; i < int(s[p[2]].size()); i++) d.push_back(a);
    for (int i = 0; i < int(s[p[0]].size()); i++) d[0][i] = s[p[0]][i];
    for (int i = 0; i < int(s[p[1]].size()); i++) d[i][0] = s[p[1]][i];
    for (int i = 0; i < int(s[p[2]].size()); i++)
      d[i][int(s[p[0]].size()) - 1] = s[p[2]][i];
    for (int i = 0; i < int(s[p[3]].size()); i++)
      d[int(s[p[1]].size()) - 1][i] = s[p[3]][i];
    for (int i = 0; i < int(s[p[4]].size()); i++)
      d[int(s[p[1]].size()) - 1 + i][int(s[p[3]].size()) - 1] = s[p[4]][i];
    for (int i = 0; i < int(s[p[5]].size()); i++)
      d[int(s[p[2]].size()) - 1][int(s[p[0]].size()) - 1 + i] = s[p[5]][i];
    anw.push_back(d);
  } while (next_permutation(p.begin(), p.end()));
  if (anw.size() == 0) {
    cout << "Impossible" << endl;
    return 0;
  }
  sort(anw.begin(), anw.end(), mf);
  for (int i = 0; i < anw[0].size(); i++) cout << anw[0][i] << endl;
}
