#include <bits/stdc++.h>
using namespace std;
vector<string> ret;
void format_crossword(vector<string>& v) {
  if (v[1][0] != v[0][0]) return;
  if (v[0][v[0].size() - 1] != v[2][0]) return;
  if (v[1][v[1].size() - 1] != v[3][0]) return;
  if (v[2].size() <= v[1].size()) return;
  if (v[3].size() <= v[0].size()) return;
  if (v[3][v[0].size() - 1] != v[2][v[1].size() - 1]) return;
  if (v[4][0] != v[2][v[2].size() - 1]) return;
  if ((v[0].size() + v[4].size()) != (v[3].size() + 1)) return;
  if (v[5][0] != v[3][v[3].size() - 1]) return;
  if (v[5][v[5].size() - 1] != v[4][v[4].size() - 1]) return;
  if ((v[1].size() + v[5].size()) != (v[2].size() + 1)) return;
  int m = v[3].size(), n = v[2].size();
  vector<string> form(n, string(m, '.'));
  int i = 0, j = 0, s = 0;
  while (s < v[0].size()) {
    form[i][j] = v[0][s];
    j++, s++;
  }
  i = 0, j = 0, s = 0;
  while (s < v[1].size()) {
    form[i][j] = v[1][s];
    i++, s++;
  }
  i = 0, j = v[0].size() - 1, s = 0;
  while (s < v[2].size()) {
    form[i][j] = v[2][s];
    i++, s++;
  }
  i = v[1].size() - 1, j = 0, s = 0;
  while (s < v[3].size()) {
    form[i][j] = v[3][s];
    j++, s++;
  }
  i = v[2].size() - 1, j = v[0].size() - 1, s = 0;
  while (s < v[4].size()) {
    form[i][j] = v[4][s];
    j++, s++;
  }
  i = v[1].size() - 1, j = v[3].size() - 1, s = 0;
  while (s < v[5].size()) {
    form[i][j] = v[5][s];
    i++, s++;
  }
  if (ret.size() == 0)
    ret = form;
  else if (ret > form)
    ret = form;
}
int main() {
  vector<string> v(6);
  for (int i = 0; i < 6; i++) cin >> v[i];
  sort(v.begin(), v.end());
  do {
    format_crossword(v);
  } while (next_permutation(v.begin(), v.end()));
  if (ret.size() == 0)
    cout << "Impossible" << endl;
  else {
    for (int i = 0; i < ret.size(); i++) {
      cout << ret[i] << endl;
    }
  }
}
