#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const long long inf = 2e18 + 1;
const int mx = 4e7 + 1;
vector<string> temp(7);
vector<string> ans;
vector<int> p(6);
bool flag = false;
void build_and_compare(string &first, string &second, string &third,
                       string &fourth, string &fifth, string &sixth) {
  int n, m;
  n = third.size();
  m = fourth.size();
  int j = 0;
  int k = 0;
  string s("\0");
  for (int i = 0; i < m; ++i) s += '.';
  vector<string> just(n, s);
  for (int i = 0; i < first.size(); ++i) {
    just[0][i] = first[i];
  }
  for (int i = 0; i < second.size(); ++i) {
    just[i][0] = second[i];
  }
  for (int i = 0; i < third.size(); ++i) {
    just[i][first.size() - 1] = third[i];
  }
  for (int i = 0; i < fourth.size(); ++i) {
    just[second.size() - 1][i] = fourth[i];
  }
  for (int i = second.size() - 1; i < n; ++i) {
    just[i][m - 1] = fifth[j++];
  }
  for (int i = first.size() - 1; i < m; ++i) {
    just[n - 1][i] = sixth[k++];
  }
  if (flag == false) {
    flag = true;
    ans = just;
  } else {
    int n1 = ans.size();
    int p = min(n1, n);
    for (int i = 0; i < p; ++i) {
      if (ans[i] < just[i]) return;
      if (just[i] < ans[i]) {
        ans = just;
        return;
      }
    }
    if (n1 < n) return;
    ans = just;
  }
}
void solve() {
  string first = temp[p[0]];
  string second = temp[p[1]];
  string third = temp[p[2]];
  string fourth = temp[p[3]];
  string fifth = temp[p[4]];
  string sixth = temp[p[5]];
  if ((first[0] == second[0]) && (first.back() == third[0]) &&
      (second.back() == fourth[0]) && (fourth.back() == fifth[0]) &&
      (third.back() == sixth[0]) && (sixth.back() == fifth.back()) &&
      (fourth.size() >= first.size() + 2) &&
      (third.size() >= second.size() + 2) &&
      (fourth[first.size() - 1] == third[second.size() - 1]) &&
      (second.size() + fifth.size() - 1 == third.size()) &&
      (first.size() + sixth.size() - 1 == fourth.size())) {
    build_and_compare(first, second, third, fourth, fifth, sixth);
  } else {
    return;
  }
}
void input() {
  iota(p.begin(), p.end(), 1);
  for (int i = 1; i <= 6; ++i) cin >> temp[i];
  do {
    solve();
  } while (next_permutation(p.begin(), p.end()));
  if (flag == false) {
    cout << "Impossible" << endl;
  } else {
    for (int i = 0; i < ans.size(); ++i) {
      cout << ans[i] << endl;
    }
  }
}
int main() {
  input();
  return 0;
}
