#include <bits/stdc++.h>
using namespace std;
string str[7];
int l1, l2, l3, l4, l5, l6;
char ch[100][100];
char opt[100][100];
bool found = false;
int len, wid;
bool comp(int l, int w) {
  int i, j;
  bool tr = true;
  for (i = 0; i < min(l, len); i++) {
    for (j = 0; j < min(w, wid); j++)
      if (ch[i][j] < opt[i][j])
        return true;
      else if (ch[i][j] > opt[i][j])
        return false;
    if (wid > w) return true;
  }
  if (wid > w) return true;
  if (len > l) return true;
  return false;
}
void fun() {
  int i, j;
  for (i = 0; i < 100; i++)
    for (j = 0; j < 100; j++) ch[i][j] = '.';
  for (i = 0; i < l4; i++) ch[0][i] = str[4][i];
  for (i = 0; i < l1; i++) ch[i][0] = str[1][i];
  for (i = 0; i < l2; i++) ch[i][l4 - 1] = str[2][i];
  for (i = 0; i < l5; i++) ch[l1 - 1][i] = str[5][i];
  for (i = 0; i < l3; i++) ch[l1 - 1 + i][l5 - 1] = str[3][i];
  for (i = 0; i < l6; i++) ch[l2 - 1][l4 - 1 + i] = str[6][i];
  if (!found) {
    found = true;
    len = l2, wid = l5;
    for (i = 0; i < 100; i++)
      for (j = 0; j < 100; j++) opt[i][j] = ch[i][j];
  } else {
    if (comp(l2, l5)) {
      len = l2, wid = l5;
      for (i = 0; i < 100; i++)
        for (j = 0; j < 100; j++) opt[i][j] = ch[i][j];
    }
  }
  return;
}
int main() {
  int i, j, k;
  for (i = 1; i <= 6; i++) cin >> str[i];
  sort(str + 1, str + 7);
  k = 0;
  do {
    l1 = str[1].length(), l2 = str[2].length(), l3 = str[3].length(),
    l4 = str[4].length(), l5 = str[5].length(), l6 = str[6].length();
    if (l1 + l3 - 1 == l2 && l4 + l6 - 1 == l5 && l4 > 2 && l6 > 2 &&
        str[1][0] == str[4][0] && str[4][l4 - 1] == str[2][0] &&
        str[1][l1 - 1] == str[5][0] && str[5][l5 - 1] == str[3][0] &&
        str[2][l2 - 1] == str[6][0] && str[3][l3 - 1] == str[6][l6 - 1] &&
        str[2][l1 - 1] == str[5][l4 - 1]) {
      fun();
    }
  } while (next_permutation(str + 1, str + 7));
  if (!found)
    cout << "Impossible" << endl;
  else {
    for (i = 0; i < len; i++) {
      for (j = 0; j < wid; j++) cout << opt[i][j];
      cout << endl;
    }
  }
  return 0;
}
