#include <bits/stdc++.h>
using namespace std;
int mas[6], m, n, l[6];
string st[6], per[6];
string str;
string arr[100];
string ans[100];
int an;
int main() {
  arr[0] = "";
  for (int i = 0; i < 100; ++i) arr[0] += ".";
  for (int i = 1; i < 100; ++i) arr[i] = arr[0];
  for (int i = 0; i < 6; ++i) cin >> st[i];
  for (int i = 0; i < 6; ++i) mas[i] = i;
  for (int f = 0; f < 720; ++f) {
    for (int i = 0; i < 6; ++i) per[i] = st[mas[i]];
    for (int i = 0; i < 6; ++i) l[i] = per[i].length();
    if (0) {
      cout << "per"
           << ": ";
      for (int innercounter = 0; innercounter < 6; ++innercounter)
        cout << per[innercounter] << " ";
      cout << endl;
    };
    if (l[2] == l[0] + l[1] - 1 && l[5] == l[3] + l[4] - 1) {
      if (per[0][0] == per[3][0] && per[1][l[1] - 1] == per[4][l[4] - 1] &&
          per[0][l[0] - 1] == per[5][0] && per[1][0] == per[5][l[5] - 1] &&
          per[3][l[3] - 1] == per[2][0] && per[4][0] == per[2][l[2] - 1]) {
        if (per[5][l[3] - 1] == per[2][l[0] - 1]) {
          int n = l[5];
          int m = l[2];
          for (int i = 0; i < n; ++i)
            for (int j = 0; j < m; ++j) arr[i][j] = '.';
          for (int i = 0; i < l[0]; ++i) arr[0][i] = per[0][i];
          for (int i = 0; i < l[1]; ++i) arr[n - 1][l[0] - 1 + i] = per[1][i];
          for (int i = 0; i < l[2]; ++i) arr[l[3] - 1][i] = per[2][i];
          for (int i = 0; i < l[3]; ++i) arr[i][0] = per[3][i];
          for (int i = 0; i < l[4]; ++i) arr[l[3] - 1 + i][m - 1] = per[4][i];
          for (int i = 0; i < l[5]; ++i) arr[i][l[0] - 1] = per[5][i];
          str = "";
          bool p = true;
          for (int i = 0; i < n; ++i)
            if (arr[i].substr(0, m) < ans[i])
              break;
            else if (arr[i].substr(0, m) > ans[i]) {
              p = false;
              break;
            }
          if (p || an <= 0) {
            an = n;
            for (int i = 0; i < n; ++i) ans[i] = arr[i].substr(0, m);
          }
        }
      }
    }
    next_permutation(mas, mas + 6);
  }
  if (an == 0)
    puts("Impossible");
  else
    for (int i = 0; i < an; ++i) cout << ans[i] << endl;
  return 0;
}
