#include <bits/stdc++.h>
using namespace std;
const long long MAX = 2500000000;
const int inf = 0x3f3f3f3f;
const double EPS = 1e-9;
const double PII = 2 * asin(1.0);
const long long mod = 1e9 + 7;
int double_cmp(double x, double y = 0, double tol = EPS) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
string saida[40];
vector<int> vetor;
string mapa[6];
string aux[40];
int tam, auxt;
bool comp() {
  for (int i = 0; i < tam; ++i) {
    if (i == auxt) return true;
    if (saida[i] != aux[i]) return aux[i] < saida[i];
  }
  return false;
}
int main() {
  for (int i = 0; i < 6; ++i) saida[i].clear();
  for (int i = 0; i < 6; ++i) mapa[i].clear();
  for (int i = 0; i < 6; ++i) aux[i].clear();
  vetor.clear();
  for (int i = 0; i < 6; ++i) cin >> mapa[i];
  for (int i = 0; i < 6; ++i) vetor.push_back(i);
  bool primeiro = true;
  do {
    if (((int)mapa[vetor[0]].size()) + ((int)mapa[vetor[4]].size()) - 1 !=
        ((int)mapa[vetor[3]].size()))
      continue;
    if (((int)mapa[vetor[1]].size()) + ((int)mapa[vetor[5]].size()) - 1 !=
        ((int)mapa[vetor[2]].size()))
      continue;
    if (mapa[vetor[0]][((int)mapa[vetor[0]].size()) - 1] != mapa[vetor[2]][0])
      continue;
    if (mapa[vetor[0]][0] != mapa[vetor[1]][0]) continue;
    if (mapa[vetor[1]][((int)mapa[vetor[1]].size()) - 1] != mapa[vetor[3]][0])
      continue;
    if (mapa[vetor[2]][((int)mapa[vetor[2]].size()) - 1] != mapa[vetor[4]][0])
      continue;
    if (mapa[vetor[3]][((int)mapa[vetor[3]].size()) - 1] != mapa[vetor[5]][0])
      continue;
    if (mapa[vetor[5]][((int)mapa[vetor[5]].size()) - 1] !=
        mapa[vetor[4]][((int)mapa[vetor[4]].size()) - 1])
      continue;
    if (mapa[vetor[2]][((int)mapa[vetor[1]].size()) - 1] !=
        mapa[vetor[3]][((int)mapa[vetor[0]].size()) - 1])
      continue;
    if (primeiro) {
      primeiro = false;
      tam = ((int)mapa[vetor[2]].size());
      for (int i = 0; i < ((int)mapa[vetor[2]].size()); ++i) {
        for (int j = 0; j < ((int)mapa[vetor[3]].size()); ++j)
          saida[i] += (char)'.';
      }
      for (int i = 0; i < ((int)mapa[vetor[0]].size()); ++i)
        saida[0][i] = mapa[vetor[0]][i];
      for (int i = 0; i < ((int)mapa[vetor[3]].size()); ++i)
        saida[((int)mapa[vetor[1]].size()) - 1][i] = mapa[vetor[3]][i];
      for (int i = 0; i < ((int)mapa[vetor[4]].size()); ++i)
        saida[((int)mapa[vetor[2]].size()) - 1]
             [i + ((int)mapa[vetor[0]].size()) - 1] = mapa[vetor[4]][i];
      for (int j = 0; j < ((int)mapa[vetor[1]].size()); ++j)
        saida[j][0] = mapa[vetor[1]][j];
      for (int j = 0; j < ((int)mapa[vetor[2]].size()); ++j)
        saida[j][((int)mapa[vetor[0]].size()) - 1] = mapa[vetor[2]][j];
      for (int j = 0; j < ((int)mapa[vetor[5]].size()); ++j)
        saida[j + ((int)mapa[vetor[1]].size()) - 1]
             [((int)mapa[vetor[3]].size()) - 1] = mapa[vetor[5]][j];
    } else {
      for (int i = 0; i < 40; ++i) aux[i].clear();
      auxt = ((int)mapa[vetor[2]].size());
      for (int i = 0; i < ((int)mapa[vetor[2]].size()); ++i) {
        for (int j = 0; j < ((int)mapa[vetor[3]].size()); ++j)
          aux[i] += (char)'.';
      }
      for (int i = 0; i < ((int)mapa[vetor[0]].size()); ++i)
        aux[0][i] = mapa[vetor[0]][i];
      for (int i = 0; i < ((int)mapa[vetor[3]].size()); ++i)
        aux[((int)mapa[vetor[1]].size()) - 1][i] = mapa[vetor[3]][i];
      for (int i = 0; i < ((int)mapa[vetor[4]].size()); ++i)
        aux[((int)mapa[vetor[2]].size()) - 1]
           [i + ((int)mapa[vetor[0]].size()) - 1] = mapa[vetor[4]][i];
      for (int j = 0; j < ((int)mapa[vetor[1]].size()); ++j)
        aux[j][0] = mapa[vetor[1]][j];
      for (int j = 0; j < ((int)mapa[vetor[2]].size()); ++j)
        aux[j][((int)mapa[vetor[0]].size()) - 1] = mapa[vetor[2]][j];
      for (int j = 0; j < ((int)mapa[vetor[5]].size()); ++j)
        aux[j + ((int)mapa[vetor[1]].size()) - 1]
           [((int)mapa[vetor[3]].size()) - 1] = mapa[vetor[5]][j];
      if (comp()) {
        tam = auxt;
        for (int i = 0; i < tam; ++i) saida[i] = aux[i];
      }
    }
  } while (next_permutation(vetor.begin(), vetor.end()));
  if (primeiro)
    printf("Impossible\n");
  else
    for (int i = 0; i < tam; ++i) cout << saida[i] << endl;
}
