#include <bits/stdc++.h>
using namespace std;
string s[6];
char was;
vector<string> best;
void check() {
  vector<string> a;
  int A = ((int)s[0].size()) - 1, B = ((int)s[3].size()) - 1,
      C = ((int)s[1].size()) - 1, D = ((int)s[4].size()) - 1;
  if (s[0][0] != s[3][0] || s[0][A] != s[4][0] || s[3][B] != s[1][0] ||
      s[4][B] != s[1][A] || s[5][0] != s[1][C] || s[4][D] != s[2][0] ||
      s[2][s[2].size() - 1] != s[5][s[5].size() - 1])
    return;
  a.assign(((int)s[4].size()), string(((int)s[1].size()), '.'));
  for (int i = 0; i < ((int)s[0].size()); i++) a[0][i] = s[0][i];
  for (int i = 0; i < ((int)s[1].size()); i++) a[B][i] = s[1][i];
  for (int i = 0; i < ((int)s[2].size()); i++) a[D][A + i] = s[2][i];
  for (int i = 0; i < ((int)s[3].size()); i++) a[i][0] = s[3][i];
  for (int i = 0; i < ((int)s[4].size()); i++) a[i][A] = s[4][i];
  for (int i = 0; i < ((int)s[5].size()); i++) a[B + i][C] = s[5][i];
  was = 1;
  if (best.empty() || best > a) best = a;
}
int main() {
  for (int i = 0; i < 6; i++) cin >> s[i];
  sort(s, s + 6);
  do {
    if (((int)s[0].size()) + ((int)s[2].size()) - 1 == ((int)s[1].size()) &&
        ((int)s[3].size()) + ((int)s[5].size()) - 1 == ((int)s[4].size()))
      check();
  } while (next_permutation(s, s + 6));
  if (was) {
    for (int i = 0; i < ((int)best.size()); i++) cout << best[i] << endl;
  } else
    printf("Impossible");
  return 0;
}
