#include <bits/stdc++.h>
using namespace std;
int f;
vector<string> cur;
void upd(string s, int x, int y, int o) {
  int dx = 0, dy = 1;
  if (o) swap(dx, dy);
  for (int i = 0; i < s.size(); i++) {
    int xx = x + dx * i;
    int yy = y + dy * i;
    if (cur[xx][yy] == '.' || cur[xx][yy] == s[i]) {
      cur[xx][yy] = s[i];
    } else {
      f = 0;
    }
  }
}
int main() {
  vector<string> a(6);
  for (auto &x : a) {
    cin >> x;
  }
  sort((a).begin(), (a).end());
  vector<string> ans = {"Z"};
  ans[0][0]++;
  vector<string> ans0 = ans;
  do {
    f = 1;
    vector<int> b;
    vector<int> c;
    for (int t = 0; t < 6; t += 3) {
      int mx = 0;
      int s = 0;
      for (int i = t; i < t + 3; i++) {
        s += a[i].size();
        mx = max(mx, (int)a[i].size());
      }
      for (int i = t; i < t + 3; i++) {
        if (a[i].size() == mx) {
          b.push_back(i);
          break;
        }
      }
      if (s - 2 * mx != 1) {
        f = 0;
      }
    }
    for (int i = 0; i < 6; i++) {
      if (i != b[0] && i != b[1]) {
        c.push_back(i);
      }
    }
    if (f) {
      vector<int> bb, cc;
      for (auto x : b) bb.push_back(a[x].size());
      for (auto x : c) cc.push_back(a[x].size());
      string t;
      for (int i = 0; i < bb[1]; i++) {
        t.push_back('.');
      }
      cur = vector<string>(bb[0], t);
      upd(a[c[0]], 0, 0, 1);
      upd(a[c[2]], 0, 0, 0);
      upd(a[b[0]], 0, cc[2] - 1, 1);
      upd(a[b[1]], cc[0] - 1, 0, 0);
      upd(a[c[1]], cc[0] - 1, bb[1] - 1, 1);
      upd(a[c[3]], bb[0] - 1, cc[2] - 1, 0);
    }
    if (f) {
      if (cur < ans) ans = cur;
    }
  } while (next_permutation((a).begin(), (a).end()));
  if (ans == ans0) {
    cout << "Impossible" << endl;
    return 0;
  }
  for (auto s : ans) {
    cout << s << endl;
  }
  return 0;
}
