#include <bits/stdc++.h>
using namespace std;
string str[6];
int main() {
  for (long long i = 0; i < ((long long)6); i++) cin >> str[i];
  vector<long long> vec;
  for (long long i = 0; i < ((long long)6); i++) vec.push_back(i);
  vector<string> res(100, string(100, '~'));
  do {
    if (((long long)str[vec[0]].size()) + ((long long)str[vec[5]].size()) !=
        ((long long)str[vec[2]].size()) + 1)
      continue;
    if (((long long)str[vec[1]].size()) + ((long long)str[vec[4]].size()) !=
        ((long long)str[vec[3]].size()) + 1)
      continue;
    if (str[vec[0]][0] != str[vec[1]][0]) continue;
    if (str[vec[1]][((long long)str[vec[1]].size()) - 1] != str[vec[2]][0])
      continue;
    if (str[vec[0]][((long long)str[vec[0]].size()) - 1] != str[vec[3]][0])
      continue;
    if (str[vec[2]][((long long)str[vec[2]].size()) - 1] != str[vec[4]][0])
      continue;
    if (str[vec[3]][((long long)str[vec[3]].size()) - 1] != str[vec[5]][0])
      continue;
    if (str[vec[3]][((long long)str[vec[1]].size()) - 1] !=
        str[vec[2]][((long long)str[vec[0]].size()) - 1])
      continue;
    if (str[vec[4]][((long long)str[vec[4]].size()) - 1] !=
        str[vec[5]][((long long)str[vec[5]].size()) - 1])
      continue;
    vector<string> tmp(((long long)str[vec[3]].size()),
                       string(((long long)str[vec[2]].size()), '.'));
    for (long long i = 0; i < ((long long)((long long)str[vec[0]].size())); i++)
      tmp[0][i] = str[vec[0]][i];
    for (long long i = 0; i < ((long long)((long long)str[vec[1]].size())); i++)
      tmp[i][0] = str[vec[1]][i];
    for (long long i = 0; i < ((long long)((long long)str[vec[2]].size())); i++)
      tmp[((long long)str[vec[1]].size()) - 1][i] = str[vec[2]][i];
    for (long long i = 0; i < ((long long)((long long)str[vec[3]].size())); i++)
      tmp[i][((long long)str[vec[0]].size()) - 1] = str[vec[3]][i];
    for (long long i = 0; i < ((long long)((long long)str[vec[4]].size())); i++)
      tmp[i + ((long long)str[vec[1]].size()) - 1]
         [((long long)str[vec[2]].size()) - 1] = str[vec[4]][i];
    for (long long i = 0; i < ((long long)((long long)str[vec[5]].size())); i++)
      tmp[((long long)str[vec[3]].size()) - 1]
         [((long long)str[vec[0]].size()) - 1 + i] = str[vec[5]][i];
    res = min(res, tmp);
  } while (next_permutation(vec.begin(), vec.end()));
  if (res == vector<string>(100, string(100, '~')))
    cout << "Impossible" << endl;
  else
    for (long long i = 0; i < ((long long)((long long)res.size())); i++)
      cout << res[i] << endl;
}
