#include <bits/stdc++.h>
using namespace std;
const int M = 31;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  vector<string> s(6);
  for (string& t : s) cin >> t;
  int n = s[2].size(), m = s[3].size();
  vector<string> a, tmp = s;
  vector<string> ans(M, string(M, 'z'));
  auto check = [&]() {
    if (s[0].size() >= m || s[5].size() >= m || s[1].size() >= n ||
        s[4].size() >= n)
      return false;
    if (s[4][0] != s[3].back() || s[4].back() != s[5].back()) return false;
    if (s[3][0] != s[1].back() ||
        s[3][s[0].size() - 1] != s[2][s[1].size() - 1])
      return false;
    if (s[0].back() != s[2][0] || s[2].back() != s[5][0]) return false;
    if (s[1][0] != s[0][0]) return false;
    if (s[0].size() + s[5].size() != m + 1 ||
        s[1].size() + s[4].size() != n + 1)
      return false;
    return true;
  };
  auto process = [&]() {
    if (!check()) return false;
    a = vector<string>(n, string(m, '.'));
    a[0] = s[0] + string(m - s[0].size(), '.');
    a.back() = string(m - s[5].size(), '.') + s[5];
    for (int i = 0; i < s[1].size(); i++) a[i][0] = s[1][i];
    for (int i = 0; i < n; i++) a[i][s[0].size() - 1] = s[2][i];
    a[s[1].size() - 1] = s[3];
    string tmp = string(n - s[4].size(), '.') + s[4];
    for (int i = 0; i < n; i++) a[i][m - 1] = tmp[i];
    return true;
  };
  do {
    n = s[2].size(), m = s[3].size();
    a = vector<string>(n, string(m, '.'));
    if (process()) ans = min(ans, a);
  } while (next_permutation(begin(s), end(s)));
  s = tmp;
  do {
    n = s[2].size(), m = s[3].size();
    a = vector<string>(n, string(m, '.'));
    if (process()) ans = min(ans, a);
  } while (prev_permutation(begin(s), end(s)));
  if (ans == vector<string>(M, string(M, 'z')))
    cout << "Impossible";
  else {
    for (string t : ans) cout << t << '\n';
  }
  return 0;
}
