#include <bits/stdc++.h>
using namespace std;
vector<string> v(6);
string ans;
void print(int i, int j, int k, int l, int m, int n) {
  int ws = v[l].size();
  int hs = v[k].size();
  char mat[hs][ws];
  memset(mat, '.', hs * ws);
  for (int x = 0; x < v[i].size(); ++x) {
    mat[0][x] = v[i][x];
  }
  for (int x = 0; x < ws; ++x) {
    mat[v[j].size() - 1][x] = v[l][x];
  }
  for (int x = v[i].size() - 1; x < ws; ++x) {
    mat[hs - 1][x] = v[m][x - v[i].size() + 1];
  }
  for (int x = 0; x < v[j].size(); ++x) {
    mat[x][0] = v[j][x];
  }
  for (int x = 0; x < hs; ++x) {
    mat[x][v[i].size() - 1] = v[k][x];
  }
  for (int x = v[j].size() - 1; x < hs; ++x) {
    mat[x][ws - 1] = v[n][x - v[j].size() + 1];
  }
  string curr;
  for (int i = 0; i < hs; ++i) {
    for (int j = 0; j < ws; ++j) {
      curr += mat[i][j];
    }
    curr += '\n';
  }
  if (ans == "" || curr < ans) ans = curr;
}
int main() {
  ios::sync_with_stdio(false);
  for (int i = 0; i < 6; ++i) cin >> v[i];
  sort(v.begin(), v.end());
  ans = "";
  for (int i = 0; i < 6; ++i) {
    for (int j = 0; j < 6; ++j) {
      if (j == i) continue;
      if (v[j][0] != v[i][0]) continue;
      for (int k = 0; k < 6; ++k) {
        if (k == i || k == j) continue;
        if (v[k][0] != v[i][v[i].size() - 1]) continue;
        if (v[k].size() < v[j].size() + 2) continue;
        for (int l = 0; l < 6; ++l) {
          if (l == i || l == j || l == k) continue;
          if ((v[l][0] != v[j][v[j].size() - 1]) ||
              (v[l].size() < v[i].size() + 2) ||
              (v[l][v[i].size() - 1] != v[k][v[j].size() - 1]))
            continue;
          for (int m = 0; m < 6; ++m) {
            if (m == i || m == j || m == k || m == l) continue;
            if (v[m][0] != v[k][v[k].size() - 1] ||
                ((v[i].size() + v[m].size() - 1) != v[l].size()))
              continue;
            for (int n = 0; n < 6; ++n) {
              if (n == i || n == j || n == k || n == l || n == m) continue;
              if ((v[n][v[n].size() - 1] != v[m][v[m].size() - 1]) ||
                  ((v[n].size() + v[j].size() - 1) != v[k].size()) ||
                  (v[n][0] != v[l][v[l].size() - 1]))
                continue;
              print(i, j, k, l, m, n);
            }
          }
        }
      }
    }
  }
  if (ans != "")
    cout << ans << '\n';
  else
    cout << "Impossible\n";
  return 0;
}
