#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> v(6);
  for (int i = 0; i < 6; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  vector<vector<string>> re;
  do {
    if (v[0].size() + v[5].size() != v[3].size() + 1) {
      continue;
    }
    if (v[1].size() + v[4].size() != v[2].size() + 1) {
      continue;
    }
    if (v[0][0] != v[1][0]) {
      continue;
    }
    if (v[0].back() != v[2][0]) {
      continue;
    }
    if (v[1].back() != v[3][0]) {
      continue;
    }
    if (v[2][v[1].size() - 1] != v[3][v[0].size() - 1]) {
      continue;
    }
    if (v[3].back() != v[4][0]) {
      continue;
    }
    if (v[2].back() != v[5][0]) {
      continue;
    }
    if (v[4].back() != v[5].back()) {
      continue;
    }
    string s;
    for (int i = 0; i < v[3].size(); i++) s += ".";
    vector<string> r(v[2].size(), s);
    for (int i = 0; i < v[0].size(); i++) r[0][i] = v[0][i];
    for (int i = 0; i < v[1].size(); i++) r[i][0] = v[1][i];
    for (int i = 0; i < v[2].size(); i++) r[i][v[0].size() - 1] = v[2][i];
    for (int i = 0; i < v[3].size(); i++) r[v[1].size() - 1][i] = v[3][i];
    for (int i = 0; i < v[4].size(); i++)
      r[v[1].size() + i - 1][v[3].size() - 1] = v[4][i];
    for (int i = 0; i < v[5].size(); i++)
      r[v[2].size() - 1][v[0].size() + i - 1] = v[5][i];
    re.push_back(r);
  } while (next_permutation(v.begin(), v.end()));
  if (re.empty()) {
    cout << "Impossible\n";
    return 0;
  }
  sort(re.begin(), re.end());
  for (int i = 0; i < re[0].size(); i++) {
    cout << re[0][i] << "\n";
  }
}
