#include <bits/stdc++.h>
using namespace std;
bool Spr(vector<string>& a) {
  if (a[0][a[0].size() - 1] == a[1][0] && a[1][a[1].size() - 1] == a[2][0] &&
      a[2][a[2].size() - 1] == a[3][a[3].size() - 1] &&
      a[3][0] == a[4][a[4].size() - 1] && a[4][0] == a[5][a[5].size() - 1] &&
      a[5][0] == a[0][0] && (a[0].size() + a[2].size() - 1 == a[4].size()) &&
      (a[3].size() + a[5].size() - 1 == a[1].size()) &&
      a[1][a[5].size() - 1] == a[4][a[0].size() - 1])
    return true;
  return false;
}
void Rob(vector<string>& a, vector<string>& nap) {
  int n = nap[1].size();
  int m = nap[4].size();
  for (int i = 0; i < n; ++i) {
    string t(m, '.');
    a.push_back(t);
  }
  for (int i = 0, j = 0; j < nap[0].size(); ++j) a[i][j] = nap[0][j];
  for (int i = 0, j = nap[0].size() - 1; i < n; ++i) a[i][j] = nap[1][i];
  for (int i = n - 1, j = nap[0].size() - 1, k = 0; j < m; ++j, ++k)
    a[i][j] = nap[2][k];
  for (int i = nap[5].size() - 1, j = m - 1, k = 0; i < n; ++i, ++k)
    a[i][j] = nap[3][k];
  for (int i = nap[5].size() - 1, j = 0; j < m; ++j) a[i][j] = nap[4][j];
  for (int i = 0, j = 0; i < nap[5].size(); ++i) a[i][j] = nap[5][i];
}
bool porownanie(vector<string>& a, vector<string>& b) {
  int i = 0;
  int ile = min((int)a.size(), (int)b.size());
  while (i < ile && a[i] == b[i]) ++i;
  if (i == ile) return true;
  if (a[i] < b[i]) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  vector<string> nap(6);
  for (int i = 0; i < 6; ++i) cin >> nap[i];
  vector<int> p(6);
  for (int i = 0; i < 6; ++i) p[i] = i;
  vector<string> odp;
  do {
    vector<string> t(6);
    for (int i = 0; i < 6; ++i) t[p[i]] = nap[i];
    if (Spr(t)) {
      vector<string> temp;
      Rob(temp, t);
      if (odp.size() == 0 || porownanie(temp, odp)) odp = temp;
    }
  } while (next_permutation(p.begin(), p.end()));
  if (odp.size() != 0) {
    for (int i = 0; i < odp.size(); ++i) cout << odp[i] << endl;
  } else
    cout << "Impossible";
  return 0;
}
