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