#include <bits/stdc++.h>
using namespace std;
char a[40][40];
vector<string> ans;
bool check(const string &str, int r, int c, int d) {
  for (int i = 0; i < str.size(); i++) {
    if (a[r][c] != '.' && a[r][c] != str[i]) return false;
    a[r][c] = str[i];
    r += d;
    c += 1 - d;
  }
  return true;
}
int main() {
  ans.push_back("~");
  string s[6];
  for (int i = 0; i < 6; i++) cin >> s[i];
  sort(s, s + 6);
  do {
    if (s[0].size() + s[4].size() - 1 != s[3].size()) continue;
    if (s[1].size() + s[5].size() - 1 != s[2].size()) continue;
    memset(a, '.', sizeof(a));
    int r = s[2].size(), c = s[3].size();
    if (!check(s[0], 0, 0, 0)) continue;
    if (!check(s[1], 0, 0, 1)) continue;
    if (!check(s[2], 0, s[0].size() - 1, 1)) continue;
    if (!check(s[3], s[1].size() - 1, 0, 0)) continue;
    if (!check(s[4], r - 1, s[0].size() - 1, 0)) continue;
    if (!check(s[5], s[1].size() - 1, c - 1, 1)) continue;
    vector<string> vec;
    for (int i = 0; i < r; i++) {
      string s;
      for (int j = 0; j < c; j++) s += a[i][j];
      vec.push_back(s);
    }
    ans = min(ans, vec);
  } while (next_permutation(s, s + 6));
  if (ans[0] == "~") ans[0] = "Impossible";
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
  return 0;
}
