#include <bits/stdc++.h>
using namespace std;
const int M = 10000 + 10;
vector<string> table[30];
string s[6];
int Row = -1;
int Col = -1;
void solve(int *a, int cur_id, int n, int &number) {
  if (cur_id == n) {
    bool ok = true;
    if (s[a[0]].length() + s[a[4]].length() - 1 != s[a[3]].length()) {
      ok = false;
    }
    if (s[a[1]].length() + s[a[5]].length() - 1 != s[a[2]].length()) {
      ok = false;
    }
    if (ok == true) {
      if (s[a[0]][s[a[0]].length() - 1] != s[a[2]][0] ||
          s[a[2]][s[a[2]].length() - 1] != s[a[4]][0]) {
        ok = false;
      }
      if (s[a[1]][s[a[1]].length() - 1] != s[a[3]][0] ||
          s[a[3]][s[a[3]].length() - 1] != s[a[5]][0]) {
        ok = false;
      }
      if (s[a[0]][0] != s[a[1]][0] ||
          s[a[4]][s[a[4]].length() - 1] != s[a[5]][s[a[5]].length() - 1]) {
        ok = false;
      }
      if (s[a[2]][s[a[1]].length() - 1] != s[a[3]][s[a[0]].length() - 1]) {
        ok = false;
      }
    }
    if (ok == true) {
      vector<string> tmps[30];
      int row = s[a[2]].length();
      int col = s[a[3]].length();
      char c[30][30];
      for (int irow = 0; irow < row; irow++) {
        for (int icol = 0; icol < col; icol++) {
          c[irow][icol] = '.';
        }
      }
      for (int icol = 0; icol < s[a[0]].length(); icol++)
        c[0][icol] = s[a[0]][icol];
      for (int icol = 0; icol < s[a[3]].length(); icol++)
        c[s[a[1]].length() - 1][icol] = s[a[3]][icol];
      for (int icol = 0; icol < s[a[4]].length(); icol++)
        c[s[a[2]].length() - 1][icol + s[a[0]].length() - 1] = s[a[4]][icol];
      for (int irow = 0; irow < s[a[1]].length(); irow++)
        c[irow][0] = s[a[1]][irow];
      for (int irow = 0; irow < s[a[2]].length(); irow++)
        c[irow][s[a[0]].length() - 1] = s[a[2]][irow];
      for (int irow = 0; irow < s[a[5]].length(); irow++)
        c[irow + s[a[1]].length() - 1][s[a[3]].length() - 1] = s[a[5]][irow];
      for (int irow = 0; irow < row; irow++) {
        string t = "";
        for (int icol = 0; icol < col; icol++) {
          t = t + c[irow][icol];
        }
        tmps[irow].push_back(t);
      }
      if (number == 0) {
        Row = row;
        Col = col;
        for (int irow = 0; irow < row; irow++) {
          table[irow].push_back(tmps[irow][0]);
        }
        number++;
      } else {
        bool issmaller = true;
        int tmprow = row < Row ? row : Row;
        for (int irow = 0; irow < tmprow; irow++) {
          if (table[irow][0] < tmps[irow][0]) {
            issmaller = false;
            break;
          } else {
            if (table[irow][0] > tmps[irow][0]) {
              issmaller = true;
              break;
            }
          }
        }
        if (issmaller == true) {
          Row = row;
          Col = col;
          for (int irow = 0; irow < Row; irow++) {
            table[irow].clear();
            table[irow].push_back(tmps[irow][0]);
          }
        }
        number++;
      }
    }
    return;
  } else {
    for (int i = cur_id; i < n; i++) {
      int tmp = a[i];
      a[i] = a[cur_id];
      a[cur_id] = tmp;
      solve(a, cur_id + 1, n, number);
      tmp = a[i];
      a[i] = a[cur_id];
      a[cur_id] = tmp;
    }
  }
}
int main() {
  int a[6];
  for (int i = 0; i < 6; i++) {
    cin >> s[i];
    a[i] = i;
  }
  int number = 0;
  solve(a, 0, 6, number);
  if (number == 0) {
    cout << "Impossible" << endl;
  } else {
    for (int irow = 0; irow < Row; irow++) {
      cout << table[irow][0] << endl;
    }
  }
  return 0;
}
