#include <bits/stdc++.h>
using namespace std;
const int N = 110;
const int INF = 1000000000;
char s[8][N], ans[N][N], now[N][N];
int r[10], n, m, len[10];
int nn, mm;
bool deal() {
  if (len[r[0]] + len[r[5]] - 1 != len[r[3]]) return false;
  if (len[r[1]] + len[r[4]] - 1 != len[r[2]]) return false;
  if (s[r[0]][0] != s[r[1]][0]) return false;
  if (s[r[0]][len[r[0]] - 1] != s[r[2]][0]) return false;
  if (s[r[1]][len[r[1]] - 1] != s[r[3]][0]) return false;
  if (s[r[3]][len[r[0]] - 1] != s[r[2]][len[r[1]] - 1]) return false;
  if (s[r[3]][len[r[3]] - 1] != s[r[4]][0]) return false;
  if (s[r[2]][len[r[2]] - 1] != s[r[5]][0]) return false;
  if (s[r[5]][len[r[5]] - 1] != s[r[4]][len[r[4]] - 1]) return false;
  memset(now, '\0', sizeof(now));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) now[i][j] = '.';
  for (int i = 0; i < len[r[0]]; i++) now[0][i] = s[r[0]][i];
  for (int i = 0; i < len[r[1]]; i++) now[i][0] = s[r[1]][i];
  for (int i = 0; i < len[r[2]]; i++) now[i][len[r[0]] - 1] = s[r[2]][i];
  for (int i = 0; i < len[r[3]]; i++) now[len[r[1]] - 1][i] = s[r[3]][i];
  for (int i = 0; i < len[r[4]]; i++)
    now[i + len[r[1]] - 1][m - 1] = s[r[4]][i];
  for (int i = 0; i < len[r[5]]; i++)
    now[n - 1][len[r[0]] - 1 + i] = s[r[5]][i];
  return true;
}
bool check() {
  for (int i = 0; i < n; i++) {
    int t = strcmp(now[i], ans[i]);
    if (t == 0) continue;
    return t == -1;
  }
}
int main() {
  for (int i = 0; i < 6; i++) scanf("%s", s[i]);
  for (int i = 0; i < 6; i++) {
    r[i] = i;
    len[i] = strlen(s[i]);
  }
  bool first = true;
  do {
    n = len[r[2]];
    m = len[r[3]];
    if (deal()) {
      if (first || check()) {
        first = false;
        nn = n;
        mm = m;
        for (int i = 0; i <= n; i++)
          for (int j = 0; j <= m; j++) ans[i][j] = now[i][j];
      }
    }
  } while (next_permutation(r, r + 6));
  if (first)
    puts("Impossible");
  else {
    for (int i = 0; i < nn; i++) printf("%s\n", ans[i]);
  }
  return 0;
}
