#include <bits/stdc++.h>
using namespace std;
vector<string> ans;
string s[10];
int len[10];
char c[40][40];
void printv(int x, int y, string &s) {
  int i;
  for ((i) = 0; (i) < (int)(s.length()); (i)++) c[x + i][y] = s[i];
}
void printh(int x, int y, string &s) {
  int i;
  for ((i) = 0; (i) < (int)(s.length()); (i)++) c[x][y + i] = s[i];
}
vector<string> func(void) {
  int i, j;
  vector<string> ans;
  for ((i) = 0; (i) < (int)(6); (i)++) len[i] = s[i].length();
  if (len[0] + len[5] - len[2] != 1) return ans;
  if (len[1] + len[4] - len[3] != 1) return ans;
  if (s[0][0] != s[1][0]) return ans;
  if (s[0][len[0] - 1] != s[3][0]) return ans;
  if (s[1][len[1] - 1] != s[2][0]) return ans;
  if (s[2][len[0] - 1] != s[3][len[1] - 1]) return ans;
  if (s[4][0] != s[2][len[2] - 1]) return ans;
  if (s[5][0] != s[3][len[3] - 1]) return ans;
  if (s[4][len[4] - 1] != s[5][len[5] - 1]) return ans;
  for ((i) = 0; (i) < (int)(40); (i)++)
    for ((j) = 0; (j) < (int)(40); (j)++) c[i][j] = '.';
  printv(0, 0, s[0]);
  printv(0, len[1] - 1, s[2]);
  printv(len[0] - 1, len[3] - 1, s[5]);
  printh(0, 0, s[1]);
  printh(len[0] - 1, 0, s[3]);
  printh(len[2] - 1, len[1] - 1, s[4]);
  for ((i) = 0; (i) < (int)(len[2]); (i)++) {
    string t;
    for ((j) = 0; (j) < (int)(len[3]); (j)++) t += c[i][j];
    ans.push_back(t);
  }
  return ans;
}
int main(void) {
  int i;
  for ((i) = 0; (i) < (int)(6); (i)++) cin >> s[i];
  sort(s, s + 6);
  do {
    vector<string> tmp = func();
    if (!tmp.empty() && (ans.empty() || tmp < ans)) ans = tmp;
  } while (next_permutation(s, s + 6));
  if (ans.empty()) {
    cout << "Impossible" << endl;
  } else {
    for ((i) = 0; (i) < (int)(ans.size()); (i)++) cout << ans[i] << endl;
  }
  return 0;
}
