#include <bits/stdc++.h>
using namespace std;
char g[7][35];
int a[7];
char s[100][100];
bool judge() {
  int l[7], i, j, k;
  for (i = 1; i <= 6; i++) {
    l[i] = strlen(g[a[i]]);
  }
  int ll = l[3], cc = l[4];
  for (i = 0; i < l[1]; i++) {
    s[0][i] = g[a[1]][i];
  }
  for (i = 0; i < l[2]; i++) {
    s[i][0] = g[a[2]][i];
  }
  for (i = 0; i < l[3]; i++) {
    s[i][l[1] - 1] = g[a[3]][i];
  }
  for (i = 0; i < l[4]; i++) {
    s[l[2] - 1][i] = g[a[4]][i];
  }
  for (i = 0; i < l[5]; i++) {
    s[l[2] - 1 + i][l[4] - 1] = g[a[5]][i];
  }
  for (i = 0; i < l[6]; i++) {
    s[l[3] - 1][l[1] - 1 + i] = g[a[6]][i];
  }
  int cnt = 0;
  if (l[4] != l[1] + l[6] - 1) return false;
  if (l[3] != l[2] + l[5] - 1) return false;
  for (i = 0; i < ll; i++) {
    for (j = 0; j < cc; j++) {
      if (s[i][j] != '.') cnt++;
    }
  }
  if (cnt != l[1] + l[2] + l[3] + l[4] + l[5] + l[6] - 7) return false;
  for (i = 0; i < l[1]; i++) {
    if (s[0][i] != g[a[1]][i]) return false;
  }
  for (i = 0; i < l[2]; i++) {
    if (s[i][0] != g[a[2]][i]) return false;
  }
  for (i = 0; i < l[3]; i++) {
    if (s[i][l[1] - 1] != g[a[3]][i]) return false;
  }
  for (i = 0; i < l[4]; i++) {
    if (s[l[2] - 1][i] != g[a[4]][i]) return false;
  }
  for (i = 0; i < l[5]; i++) {
    if (s[l[2] - 1 + i][l[4] - 1] != g[a[5]][i]) return false;
  }
  for (i = 0; i < l[6]; i++) {
    if (s[l[3] - 1][l[1] - 1 + i] != g[a[6]][i]) return false;
  }
  return true;
}
int main() {
  int i, j, k;
  for (i = 1; i <= 6; i++) {
    a[i] = i;
    scanf("%s", g[i]);
  }
  int tot = 720;
  int ll, cc;
  char ans[65][65];
  bool ok = false;
  while (tot--) {
    for (i = 0; i < 100; i++)
      for (j = 0; j < 100; j++) {
        s[i][j] = '.';
      }
    if (judge()) {
      if (ok == false) {
        ok = true;
        ll = strlen(g[a[3]]), cc = strlen(g[a[4]]);
        for (i = 0; i < ll; i++) {
          for (j = 0; j < cc; j++) ans[i][j] = s[i][j];
          ans[i][j] = '\0';
        }
      } else {
        int tl = strlen(g[a[3]]), tc = strlen(g[a[4]]);
        for (i = 0; i < tl; i++) {
          s[i][tc] = '\0';
        }
        bool xx = false;
        for (i = 0; i < tl || i < ll; i++) {
          for (j = 0; j < cc || j < tc; j++) {
            if (s[i][j] != ans[i][j]) {
              xx = true;
              break;
            }
          }
          if (xx) break;
        }
        if (s[i][j] < ans[i][j]) {
          ll = tl;
          cc = tc;
          for (i = 0; i < ll; i++) {
            for (j = 0; j < cc; j++) ans[i][j] = s[i][j];
            ans[i][j] = '\0';
          }
        }
      }
    }
    next_permutation(a + 1, a + 7);
  }
  if (ok == false) {
    printf("Impossible\n");
    return 0;
  }
  for (i = 0; i < ll; i++) {
    for (j = 0; j < cc; j++) printf("%c", ans[i][j]);
    printf("\n");
  }
  return 0;
}
