#include <bits/stdc++.h>
using namespace std;
string s[7], bo2[32], sv[32];
char bo[32][32];
int u, sn, sm, n, m;
bool chk() {
  if (s[0].length() < 3 || s[0][0] != s[1][0] ||
      s[0][s[0].length() - 1] != s[2][0] || s[1].length() + 2 > s[2].length() ||
      s[3][0] != s[1][s[1].length() - 1] || s[3].length() < s[0].length() + 2 ||
      s[3][s[0].length() - 1] != s[2][s[1].length() - 1] ||
      s[3][s[3].length() - 1] != s[4][0] ||
      s[5][0] != s[2][s[2].length() - 1] ||
      s[5][s[5].length() - 1] != s[4][s[4].length() - 1] ||
      s[0].length() + s[5].length() - 1 != s[3].length() ||
      s[1].length() + s[4].length() - 1 != s[2].length())
    return false;
  return true;
}
bool cmp() {
  for (int i = 0; i < n; i++)
    if (sv[i] != bo2[i]) return sv[i] > bo2[i];
  return false;
}
void P() {
  n = s[2].length(), m = s[3].length();
  for (int j = 0; j < m; j++) bo[0][j] = (j < s[0].length() ? s[0][j] : '.');
  bo[0][m] = '\0';
  for (int i = 1; i < n - 1; i++) {
    for (int j = 0; j < m; j++) {
      if (i == s[1].length() - 1)
        bo[i][j] = s[3][j];
      else if (i < s[1].length() - 1) {
        if (j == 0)
          bo[i][j] = s[1][i];
        else if (j == s[0].length() - 1)
          bo[i][j] = s[2][i];
        else
          bo[i][j] = '.';
      } else {
        if (j == m - 1)
          bo[i][j] = s[4][i - s[1].length() + 1];
        else if (j == s[0].length() - 1)
          bo[i][j] = s[2][i];
        else
          bo[i][j] = '.';
      }
    }
    bo[i][m] = '\0';
  }
  for (int j = 0; j < m; j++)
    bo[n - 1][j] = (j < m - s[5].length() ? '.' : s[5][j - m + s[5].length()]);
  bo[n - 1][m] = '\0';
  for (int i = 0; i < n; i++) bo2[i] = bo[i];
}
int main() {
  for (int i = 0; i < 6; i++) cin >> s[i];
  sort(s, s + 6);
  do {
    if (chk()) {
      P();
      if (u == 0 || cmp()) {
        for (int i = 0; i < n; i++) sv[i] = bo2[i];
        sn = n;
        sm = m;
      }
      u = 1;
    }
  } while (next_permutation(s, s + 6));
  if (!u)
    printf("Impossible\n");
  else {
    for (int i = 0; i < sn; i++) cout << sv[i] << endl;
  }
  return 0;
}
