#include <bits/stdc++.h>
using namespace std;
const int N = 31;
const long long MOD = 1e9 + 7;
const double eps = 1e-9;
char st[N];
vector<string> s;
bool ok = 0;
vector<string> ans;
void check(vector<vector<char> > &v) {
  ok = 1;
  bool f = 0;
  if (!ans.size())
    f = 1;
  else {
    int i1 = 0, i2 = 0;
    while (i1 < ans.size() && i2 < v.size()) {
      string r = "";
      for (int j = 0; j < v[i2].size(); j++) r += v[i2][j];
      if (ans[i1] < r)
        break;
      else if (ans[i1] > r) {
        f = 1;
        break;
      }
      i1++, i2++;
    }
    if (i1 < ans.size() && i2 == v.size()) f = 1;
  }
  if (f) {
    ans.clear();
    for (int i = 0; i < v.size(); i++) {
      string r = "";
      for (int j = 0; j < v[0].size(); j++) r += v[i][j];
      ans.push_back(r);
    }
  }
}
int main() {
  for (int i = 0; i < 6; i++) {
    scanf("%s", st);
    s.push_back(string(st));
  }
  int p[6] = {0, 1, 2, 3, 4, 5};
  do {
    int n = s[p[0]].size(), m = s[p[1]].size();
    vector<vector<char> > v(n, vector<char>(m, '.'));
    int x1 = s[p[3]].size() - 1, y1 = s[p[2]].size() - 1;
    if (x1 >= n || y1 >= m || s[p[0]][x1] != s[p[1]][y1]) continue;
    for (int i = 0; i < s[p[0]].size(); i++) v[i][y1] = s[p[0]][i];
    for (int i = 0; i < s[p[1]].size(); i++) v[x1][i] = s[p[1]][i];
    if (s[p[2]].back() != s[p[0]][0]) continue;
    if (s[p[3]].back() != s[p[1]][0]) continue;
    if (s[p[2]][0] != s[p[3]][0]) continue;
    if (s[p[2]].size() > m || s[p[3]].size() > n) continue;
    for (int i = 0; i < s[p[2]].size(); i++) v[0][i] = s[p[2]][i];
    for (int i = 0; i < s[p[3]].size(); i++) v[i][0] = s[p[3]][i];
    if (s[p[4]][0] != s[p[1]].back()) continue;
    if (s[p[5]][0] != s[p[0]].back()) continue;
    if (s[p[4]].back() != s[p[5]].back()) continue;
    if (s[p[4]].size() > n - x1 || s[p[5]].size() > m - y1) continue;
    for (int i = 0, j = x1; i < s[p[4]].size(); i++, j++)
      v[j][m - 1] = s[p[4]][i];
    for (int i = 0, j = y1; i < s[p[5]].size(); i++, j++)
      v[n - 1][j] = s[p[5]][i];
    check(v);
  } while (next_permutation(p, p + 6));
  if (!ok)
    puts("Impossible");
  else {
    for (int i = 0; i < ans.size(); i++) puts(ans[i].c_str());
  }
  return 0;
}
