#include <bits/stdc++.h>
using namespace std;
string s[6];
vector<string> h, v;
vector<string> A, B;
bool cmp(string const &l, string const &r) { return l.size() < r.size(); }
bool lt() {
  int a = (int)A.size(), b = (int)B.size();
  for (int i = 0; i < a && i < b; ++i) {
    if (A[i] != B[i]) return B[i] < A[i];
  }
  return b < a;
}
void upd() {
  if (A.empty() || lt()) A = B;
}
void gen() {
  B.clear();
  int a = (int)h[0].size(), b = (int)h[1].size();
  int c = (int)v[0].size(), d = (int)v[1].size();
  string line = h[0] + string(b - 1, '.');
  B.push_back(line);
  for (int i = 1; i + 1 < c; ++i) {
    line = string(1, v[0][i]) + string(a - 2, '.') + string(1, v[2][i]) +
           string(b - 1, '.');
    B.push_back(line);
  }
  B.push_back(h[2]);
  for (int i = 1; i + 1 < d; ++i) {
    line = string(a - 1, '.') + string(1, v[2][c + i - 1]) +
           string(b - 2, '.') + string(1, v[1][i]);
    B.push_back(line);
  }
  line = string(a - 1, '.') + h[1];
  B.push_back(line);
  upd();
}
void check_again() {
  if (h[0].front() != v[0].front()) return;
  if (h[0].back() != v[2].front()) return;
  if (v[0].back() != h[2].front()) return;
  if (h[2].back() != v[1].front()) return;
  if (v[1].back() != h[1].back()) return;
  if (h[1].front() != v[2].back()) return;
  if (h[2][h[0].size() - 1] != v[2][v[0].size() - 1]) return;
  gen();
}
void check() {
  sort(h.begin(), h.end(), cmp);
  if (h[0].size() + h[1].size() != h[2].size() + 1) return;
  sort(v.begin(), v.end(), cmp);
  if (v[0].size() + v[1].size() != v[2].size() + 1) return;
  check_again();
  swap(v[0], v[1]), check_again();
  swap(h[0], h[1]), check_again();
  swap(v[0], v[1]), check_again();
}
int main() {
  for (int i = 0; i < 6; ++i) cin >> s[i];
  for (int i = 0; i < 6; ++i)
    for (int j = i + 1; j < 6; ++j)
      for (int k = j + 1; k < 6; ++k) {
        h.clear(), v.clear();
        for (int t = 0; t < 6; ++t) {
          if (t == i || t == j || t == k)
            h.push_back(s[t]);
          else
            v.push_back(s[t]);
        }
        check();
      }
  if (A.empty())
    cout << "Impossible" << endl;
  else
    for (auto &a : A) cout << a << endl;
  return 0;
}
