#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
void solve();
int main() {
  ios::sync_with_stdio(0);
  solve();
  return 0;
}
int bitCount(unsigned int v) {
  v = v - ((v >> 1) & 0x55555555);
  v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
  return ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
void solve() {
  string a[6];
  for (int i = 0; i < 6; i++) cin >> a[i];
  bool found = false;
  vector<vector<char> > ans;
  int nn = 1 << 6;
  vector<string> hor, ver;
  for (int mask = 0; mask < nn; mask++) {
    if (bitCount(mask) == 3) {
      hor.resize(0);
      ver.resize(0);
      for (int i = 0; i < 6; i++) {
        if ((1 << i) & mask) {
          hor.push_back(a[i]);
        } else {
          ver.push_back(a[i]);
        }
      }
      int n = 0, m = 0;
      for (int i = 0; i < (int)((ver).size()); i++)
        n = max(n, (int)ver[i].length());
      for (int i = 0; i < (int)((hor).size()); i++)
        m = max(m, (int)hor[i].length());
      int P1[3] = {0, 1, 2};
      do {
        string& h1 = hor[P1[0]];
        string& h2 = hor[P1[2]];
        if ((int)h1.length() + (int)h2.length() != m + 1) continue;
        if (h1.length() < 3) continue;
        if (h2.length() < 3) continue;
        int P2[3] = {0, 1, 2};
        do {
          string& v1 = ver[P2[0]];
          string& v2 = ver[P2[2]];
          if ((int)v1.length() + (int)v2.length() != n + 1) continue;
          if (v1.length() < 3) continue;
          if (v2.length() < 3) continue;
          if (h1[0] != v1[0]) continue;
          if (h2[h2.length() - 1] != v2[v2.length() - 1]) continue;
          if (hor[P1[1]][0] != v1[v1.length() - 1]) continue;
          if (hor[P1[1]][m - 1] != v2[0]) continue;
          if (ver[P2[1]][0] != h1[h1.length() - 1]) continue;
          if (ver[P2[1]][n - 1] != h2[0]) continue;
          if (hor[P1[1]][h1.length() - 1] != ver[P2[1]][v1.length() - 1])
            continue;
          {
            vector<vector<char> > field(n, vector<char>(m, '.'));
            for (int i = 0; i < (int)((h1).size()); i++) field[0][i] = h1[i];
            for (int i = 0; i < (int)((h2).size()); i++)
              field[n - 1][i + m - (int)((h2).size())] = h2[i];
            for (int i = 0; i < (int)((v1).size()); i++) field[i][0] = v1[i];
            for (int i = 0; i < (int)((v2).size()); i++)
              field[i + n - (int)((v2).size())][m - 1] = v2[i];
            for (int i = 0; i < n; i++)
              field[i][(int)((h1).size()) - 1] = ver[P2[1]][i];
            for (int i = 0; i < m; i++)
              field[(int)((v1).size()) - 1][i] = hor[P1[1]][i];
            if (!found) {
              found = true;
              ans = field;
            } else {
              if (field < ans) ans = field;
            }
          }
        } while (next_permutation(P2, P2 + 3));
      } while (next_permutation(P1, P1 + 3));
    }
  }
  if (found) {
    int n = (int)((ans).size());
    int m = (int)((ans[0]).size());
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cout << ans[i][j];
      }
      cout << '\n';
    }
    return;
  }
  cout << "Impossible\n";
}
