#include <bits/stdc++.h>
using namespace std;
vector<string> ret;
void draw(int x, int y, int dx, int dy, string s, vector<string> &w) {
  int i;
  if (dy == 0) {
    for (i = x; i - x < s.size(); i++) w[i][y] = s[i - x];
  } else {
    for (i = y; i - y < s.size(); i++) w[x][i] = s[i - y];
  }
}
int main() {
  ios::sync_with_stdio(false);
  int i, len[6], rows;
  vector<string> s(6);
  for (i = 0; i < 6; i++) {
    cin >> s[i];
  }
  sort(s.begin(), s.end());
  ret.clear();
  do {
    for (i = 0; i < 6; i++) {
      len[i] = s[i].size();
    }
    if (len[0] + len[2] != len[1] + 1 || len[3] + len[5] != len[4] + 1 ||
        s[0][0] != s[3][0] || s[0][len[0] - 1] != s[4][0] ||
        s[1][0] != s[3][len[3] - 1] || s[1][len[0] - 1] != s[4][len[3] - 1] ||
        s[1][len[1] - 1] != s[5][0] || s[2][0] != s[4][len[4] - 1] ||
        s[2][len[2] - 1] != s[5][len[5] - 1])
      continue;
    vector<string> w(len[4], string(len[1], '.'));
    draw(0, 0, 0, 1, s[0], w);
    draw(len[3] - 1, 0, 0, 1, s[1], w);
    draw(len[4] - 1, len[0] - 1, 0, 1, s[2], w);
    draw(0, 0, 1, 0, s[3], w);
    draw(0, len[0] - 1, 1, 0, s[4], w);
    draw(len[3] - 1, len[1] - 1, 1, 0, s[5], w);
    if (ret.size() == 0 || ret > w) {
      ret = w;
      rows = len[4];
    }
  } while (next_permutation(s.begin(), s.end()));
  if (ret.size() == 0) {
    cout << "Impossible" << endl;
    return 0;
  }
  for (i = 0; i < rows; i++) cout << ret[i] << endl;
  return 0;
}
