#include <bits/stdc++.h>
using namespace std;
vector<string> a;
vector<string> res, temp;
int main() {
  a.resize(6);
  res.resize(30, "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[");
  for (int i = 0; i < 6; i++) cin >> a[i];
  int z = 0;
  while (z < 720) {
    if (a[2].length() == a[1].length() + a[0].length() - 1 &&
        a[5].length() == a[4].length() + a[3].length() - 1) {
      if (a[0][0] == a[3][0] && a[0][a[0].length() - 1] == a[5][0] &&
          a[2][0] == a[3][a[3].length() - 1] &&
          a[2][a[0].length() - 1] == a[5][a[3].length() - 1] &&
          a[2][a[2].length() - 1] == a[4][0] &&
          a[1][0] == a[5][a[5].length() - 1] &&
          a[1][a[1].length() - 1] == a[4][a[4].length() - 1]) {
        temp.clear();
        temp.resize(a[5].length());
        for (int i = 0; i < a[5].length(); i++)
          temp[i].resize(a[2].length(), '.');
        for (int i = 0; i < a[0].length(); i++) temp[0][i] = a[0][i];
        for (int i = 0; i < a[2].length(); i++)
          temp[a[3].length() - 1][i] = a[2][i];
        for (int i = 0; i < a[1].length(); i++)
          temp[a[5].length() - 1][a[0].length() - 1 + i] = a[1][i];
        for (int i = 0; i < a[3].length(); i++) temp[i][0] = a[3][i];
        for (int i = 0; i < a[5].length(); i++)
          temp[i][a[0].length() - 1] = a[5][i];
        for (int i = 0; i < a[4].length(); i++)
          temp[i + a[3].length() - 1][a[2].length() - 1] = a[4][i];
        for (int i = 0; i < a[2].length(); i++) {
          if (res[i] > temp[i]) {
            res.swap(temp);
            break;
          }
          if (res[i] < temp[i]) break;
        }
      }
    }
    next_permutation(a.begin(), a.end());
    z++;
  }
  if (res[0][0] == '[')
    cout << "Impossible";
  else
    for (int i = 0; i < res.size(); cout << endl, i++)
      for (int j = 0; j < res[i].size(); cout << res[i][j], j++)
        ;
}
