#include <bits/stdc++.h>
using namespace std;
string s[9], v[35], k[35];
bool in[9];
int len, a[9], l[9], ans;
char c[35][35];
bool check2() {
  if (ans == 0) return 1;
  for (int i = 1; i <= min(len, ans); i++)
    if (v[i] < k[i])
      return 1;
    else if (v[i] > k[i])
      return 0;
  if (len > ans) return 0;
  return 1;
}
void check() {
  if (l[a[1]] + l[a[3]] - 1 != l[a[2]]) return;
  if (l[a[4]] + l[a[6]] - 1 != l[a[5]]) return;
  if (s[a[1]][0] != s[a[4]][0]) return;
  if (s[a[4]][l[a[4]] - 1] != s[a[2]][0]) return;
  if (s[a[6]][0] != s[a[2]][l[a[2]] - 1]) return;
  if (s[a[6]][l[a[6]] - 1] != s[a[3]][l[a[3]] - 1]) return;
  if (s[a[5]][0] != s[a[1]][l[a[1]] - 1]) return;
  if (s[a[5]][l[a[5]] - 1] != s[a[3]][0]) return;
  if (s[a[5]][l[a[4]] - 1] != s[a[2]][l[a[1]] - 1]) return;
  for (int i = 1; i <= l[a[5]]; i++)
    for (int j = 1; j <= l[a[2]]; j++) c[i][j] = '.';
  for (int i = 0; i < l[a[1]]; i++) c[1][i + 1] = s[a[1]][i];
  for (int i = 0; i < l[a[2]]; i++) c[l[a[4]]][i + 1] = s[a[2]][i];
  for (int i = 0; i < l[a[3]]; i++) c[l[a[5]]][i + l[a[1]]] = s[a[3]][i];
  for (int i = 0; i < l[a[4]]; i++) c[i + 1][1] = s[a[4]][i];
  for (int i = 0; i < l[a[5]]; i++) c[i + 1][l[a[1]]] = s[a[5]][i];
  for (int i = 0; i < l[a[6]]; i++) c[i + l[a[4]]][l[a[2]]] = s[a[6]][i];
  len = l[a[5]];
  for (int i = 1; i <= len; i++) {
    v[i] = "";
    for (int j = 1; j <= l[a[2]]; j++) v[i] += c[i][j];
  }
  if (check2()) {
    ans = len;
    for (int i = 1; i <= len; i++) k[i] = v[i];
  }
}
int main() {
  for (int i = 1; i <= 6; i++) cin >> s[i], l[i] = s[i].length();
  for (a[1] = 1; a[1] <= 6; a[1]++)
    for (a[2] = 1; a[2] <= 6; a[2]++)
      for (a[3] = 1; a[3] <= 6; a[3]++)
        for (a[4] = 1; a[4] <= 6; a[4]++)
          for (a[5] = 1; a[5] <= 6; a[5]++)
            for (a[6] = 1; a[6] <= 6; a[6]++) {
              set<int> s1;
              s1.insert(a[1]);
              s1.insert(a[2]);
              s1.insert(a[3]);
              s1.insert(a[4]);
              s1.insert(a[5]);
              s1.insert(a[6]);
              if (s1.size() != 6) continue;
              check();
            }
  if (ans == 0)
    printf("Impossible");
  else
    for (int i = 1; i <= ans; i++) cout << k[i] << endl;
}
