#include <bits/stdc++.h>
using namespace std;
string s[6], t[6];
string cur[30], best[30];
int besty = -1, cury, curx;
bool used[6] = {};
int len[6];
int cnt;
void go(int pos) {
  if (pos == 6) {
    for (int i = 0; i < (int)(6); ++i) len[i] = (int)t[i].length();
    if (len[0] + len[2] - 1 != len[1]) return;
    if (len[3] + len[5] - 1 != len[4]) return;
    if (t[0][0] != t[3][0]) return;
    if (t[0].back() != t[4][0]) return;
    if (t[1][0] != t[3].back()) return;
    if (t[1].back() != t[5][0]) return;
    if (t[2][0] != t[4].back()) return;
    if (t[2].back() != t[5].back()) return;
    if (t[1][len[0] - 1] != t[4][len[3] - 1]) return;
    cury = len[4];
    curx = len[1];
    for (int i = 0; i < (int)(cury); ++i) cur[i].assign(curx, '.');
    for (int i = 0; i < (int)(len[0]); ++i) cur[0][i] = t[0][i];
    for (int i = 0; i < (int)(len[1]); ++i) cur[len[3] - 1][i] = t[1][i];
    for (int i = 0; i < (int)(len[2]); ++i)
      cur[len[4] - 1][len[0] - 1 + i] = t[2][i];
    for (int i = 0; i < (int)(len[3]); ++i) cur[i][0] = t[3][i];
    for (int i = 0; i < (int)(len[4]); ++i) cur[i][len[0] - 1] = t[4][i];
    for (int i = 0; i < (int)(len[5]); ++i)
      cur[len[3] - 1 + i][len[1] - 1] = t[5][i];
    bool ok = true, done = false;
    if (besty != -1) {
      int mn = min(besty, cury);
      for (int i = 0; i < (int)(mn); ++i)
        if (best[i] < cur[i]) {
          ok = false;
          done = true;
          break;
        } else if (best[i] > cur[i]) {
          done = true;
          break;
        }
      if (!done && besty <= cury) {
        ok = false;
      }
    }
    if (ok) {
      besty = cury;
      for (int i = 0; i < (int)(cury); ++i) best[i] = cur[i];
    }
    return;
  }
  for (int i = 0; i < (int)(6); ++i)
    if (!used[i]) {
      t[pos] = s[i];
      used[i] = true;
      go(pos + 1);
      used[i] = false;
    }
}
int main() {
  for (int i = 0; i < (int)(6); ++i) cin >> s[i];
  go(0);
  if (besty == -1) {
    cout << "Impossible" << endl;
  } else {
    for (int i = 0; i < (int)(besty); ++i) cout << best[i] << endl;
  }
  return 0;
}
