#include <bits/stdc++.h>
using namespace std;
vector<long long int> v1;
vector<long long int> v2;
vector<long long int> v3;
const long long int inf = 100000000000005;
bool valid(char a) {
  if (a != '.') return 1;
  return 0;
}
bool add(char &a, char &b) {
  if (valid(a) && a != b) return false;
  a = b;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s[6];
  vector<string> ans;
  for (int i = 0; i < 6; i++) cin >> s[i];
  sort(s, s + 6);
  do {
    vector<string> curr;
    for (int i = 0; i < s[0].size(); i++) {
      string t = "";
      for (int j = 0; j < s[1].size(); j++) t += ".";
      curr.push_back(t);
    }
    if (s[0].size() != s[4].size() + s[3].size() - 1) continue;
    if (s[1].size() != s[2].size() + s[5].size() - 1) continue;
    bool ok = true;
    for (int i = 0; i < s[0].size(); i++)
      ok &= add(curr[i][s[2].size() - 1], s[0][i]);
    for (int i = 0; i < s[1].size(); i++)
      ok &= add(curr[s[3].size() - 1][i], s[1][i]);
    for (int i = 0; i < s[2].size(); i++) ok &= add(curr[0][i], s[2][i]);
    for (int i = 0; i < s[3].size(); i++) ok &= add(curr[i][0], s[3][i]);
    for (int i = 0; i < s[4].size(); i++)
      ok &= add(curr[s[3].size() - 1 + i][s[1].size() - 1], s[4][i]);
    for (int i = 0; i < s[5].size(); i++)
      ok &= add(curr[s[0].size() - 1][s[2].size() - 1 + i], s[5][i]);
    if (!ok) continue;
    if (ans.empty() || curr < ans) ans = curr;
  } while (next_permutation(s, s + 6));
  if (ans.empty())
    cout << "Impossible" << endl;
  else
    for (int i = 0; i < ans.size(); i++) cout << ans[i] << endl;
  return 0;
}
