#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
bool ph(string s, vector<string> &vs, int row, int col) {
  for (int j = 0; j < s.size(); j++) {
    if (vs[row][col + j] != s[j] && vs[row][col + j] != '.') return 1;
    vs[row][col + j] = s[j];
  }
  return 0;
}
bool pv(string s, vector<string> &vs, int row, int col) {
  for (int i = 0; i < s.size(); i++) {
    if (vs[row + i][col] != s[i] && vs[row + i][col] != '.') return 1;
    vs[row + i][col] = s[i];
  }
  return 0;
}
vector<string> solve(vector<string> vs) {
  int n = vs[2].size(), m = vs[3].size();
  vector<string> ans(n, string(m, '.'));
  vector<string> na;
  if (vs[0].size() + vs[4].size() - 1 != m ||
      vs[1].size() + vs[5].size() - 1 != n) {
    return na;
  }
  if (ph(vs[0], ans, 0, 0)) return na;
  if (pv(vs[1], ans, 0, 0)) return na;
  if (pv(vs[2], ans, 0, vs[0].size() - 1)) return na;
  if (ph(vs[3], ans, vs[1].size() - 1, 0)) return na;
  if (ph(vs[4], ans, n - 1, vs[0].size() - 1)) return na;
  if (pv(vs[5], ans, vs[1].size() - 1, m - 1)) return na;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  vector<string> vs(6);
  for (auto &s : vs) cin >> s;
  auto a = solve(vs);
  sort(vs.begin(), vs.end());
  vector<string> ans;
  do {
    auto ans2 = solve(vs);
    if (ans2.size() && (!ans.size() || ans2 < ans)) ans = ans2;
  } while (next_permutation(vs.begin(), vs.end()));
  if (!ans.size()) {
    cout << "Impossible";
  } else {
    for (auto s : ans) {
      cout << s << '\n';
    }
  }
  return 0;
}
