#include <bits/stdc++.h>
using namespace std;
int f_max(int x, int y) { return x > y ? x : y; }
int f_min(int x, int y) { return x < y ? x : y; }
void f_swap(int &x, int &y) {
  int t;
  t = x, x = y, y = t;
}
int f_abs(int x) { return x > 0 ? x : -x; }
char s[100][100];
char ans[100][100];
int l, r;
char tmp[100][100];
int arr[100];
int len[100];
int main() {
  int i, j;
  int tt = 6;
  l = r = -1;
  for (i = 0; i < 6; i++) scanf("%s", s[i]);
  for (i = 0; i < 6; i++) arr[i] = i;
  do {
    for (i = 0; i < 6; i++) len[i] = strlen(s[arr[i]]);
    if (len[0] + len[1] - 1 != len[2]) continue;
    if (len[3] + len[4] - 1 != len[5]) continue;
    if (s[arr[0]][0] != s[arr[3]][0]) continue;
    if (s[arr[0]][len[0] - 1] != s[arr[5]][0]) continue;
    if (s[arr[3]][len[3] - 1] != s[arr[2]][0]) continue;
    if (s[arr[2]][len[2] - 1] != s[arr[4]][0]) continue;
    if (s[arr[4]][len[4] - 1] != s[arr[1]][len[1] - 1]) continue;
    if (s[arr[5]][len[5] - 1] != s[arr[1]][0]) continue;
    if (s[arr[5]][len[3] - 1] != s[arr[2]][len[0] - 1]) continue;
    int nn = 0;
    for (i = 0; i < len[5]; i++) {
      for (j = 0; j < len[2]; j++) {
        tmp[i][j] = '.';
        nn++;
      }
      tmp[i][j] = 0;
    }
    for (i = 0; i < len[0]; i++) tmp[0][i] = s[arr[0]][i];
    for (i = 0; i < len[1]; i++) tmp[len[5] - 1][len[0] - 1 + i] = s[arr[1]][i];
    for (i = 0; i < len[2]; i++) tmp[len[3] - 1][i] = s[arr[2]][i];
    for (i = 0; i < len[3]; i++) tmp[i][0] = s[arr[3]][i];
    for (i = 0; i < len[4]; i++) tmp[len[3] - 1 + i][len[2] - 1] = s[arr[4]][i];
    for (i = 0; i < len[5]; i++) tmp[i][len[0] - 1] = s[arr[5]][i];
    if (l == -1) {
      for (i = 0; i < len[5]; i++) {
        for (j = 0; j <= len[2]; j++) {
          ans[i][j] = tmp[i][j];
        }
      }
      l = len[5], r = len[2];
    } else {
      int f = 0;
      for (i = 0; i < len[5] && i < l; i++) {
        if (strcmp(tmp[i], ans[i]) > 0) {
          f = -1;
          break;
        } else if (strcmp(tmp[i], ans[i]) < 0) {
          f = 1;
          break;
        }
      }
      if (f == 0) {
        if (i != l) {
          for (i = 0; i < len[5]; i++) {
            for (j = 0; j <= len[2]; j++) {
              ans[i][j] = tmp[i][j];
            }
          }
          l = len[5], r = len[2];
        }
      } else if (f == 1) {
        for (i = 0; i < len[5]; i++) {
          for (j = 0; j <= len[2]; j++) {
            ans[i][j] = tmp[i][j];
          }
        }
        l = len[5], r = len[2];
      }
    }
  } while (next_permutation(arr, arr + 6));
  if (l == -1)
    printf("Impossible\n");
  else
    for (i = 0; i < l; i++) printf("%s\n", ans[i]);
  return 0;
}
