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