#include <bits/stdc++.h>
using namespace std;
void place_horiz(vector<string>& B, int r0, int c0, const string& s) {
  for (int i = 0; i < (int)s.size(); ++i) B[r0][c0 + i] = s[i];
}
void place_vert(vector<string>& B, int r0, int c0, const string& s) {
  for (int i = 0; i < (int)s.size(); ++i) B[r0 + i][c0] = s[i];
}
vector<string> place(const vector<string>& words) {
  const int R = int((words[2]).size());
  const int C = int((words[3]).size());
  if (R != int((words[1]).size()) + int((words[4]).size()) - 1 ||
      C != int((words[0]).size()) + int((words[5]).size()) - 1)
    return {};
  if (words[0][0] != words[1][0] ||
      words[0][int((words[0]).size()) - 1] != words[2][0] ||
      words[1][int((words[1]).size()) - 1] != words[3][0] ||
      words[3][int((words[3]).size()) - 1] != words[4][0] ||
      words[2][int((words[2]).size()) - 1] != words[5][0] ||
      words[4][int((words[4]).size()) - 1] !=
          words[5][int((words[5]).size()) - 1] ||
      words[2][int((words[1]).size()) - 1] !=
          words[3][int((words[0]).size()) - 1])
    return {};
  vector<string> B(R, string(C, '.'));
  place_horiz(B, 0, 0, words[0]);
  place_vert(B, 0, 0, words[1]);
  place_vert(B, 0, int((words[0]).size()) - 1, words[2]);
  place_horiz(B, int((words[1]).size()) - 1, 0, words[3]);
  place_vert(B, int((words[1]).size()) - 1, int((words[3]).size()) - 1,
             words[4]);
  place_horiz(B, int((words[2]).size()) - 1, int((words[0]).size()) - 1,
              words[5]);
  return B;
}
int main(int argc, char* argv[]) {
  vector<string> words(6);
  for (int i = 0, _n = (6); i < _n; ++i) cin >> words[i];
  sort(words.begin(), words.end());
  vector<string> best;
  do {
    vector<string> cur = place(words);
    if (!cur.empty()) {
      if (best.empty() || best > cur) best = cur;
    }
  } while (next_permutation(words.begin(), words.end()));
  if (best.empty()) {
    cout << "Impossible" << endl;
  } else {
    for (string row : best) cout << row << endl;
  }
  return 0;
}
