#include <bits/stdc++.h>
using namespace std;
vector<string> ret(1, string(1, 127));
int main() {
  vector<string> str(6);
  for (int i = 0; i < 6; i++) {
    cin >> str[i];
  }
  sort(str.begin(), str.end());
  do {
    if (str[0].size() + str[1].size() != str[2].size() + 1 ||
        str[3].size() + str[4].size() != str[5].size() + 1)
      continue;
    if (str[0][0] != str[3][0] || str[1].back() != str[4].back() ||
        str[0].back() != str[5][0] || str[1][0] != str[5].back() ||
        str[3].back() != str[2][0] || str[4][0] != str[2].back())
      continue;
    if (str[2][str[0].size() - 1] != str[5][str[3].size() - 1]) continue;
    vector<string> cur(str[5].size(), string(str[2].size(), '.'));
    for (size_t i = 0; i < str[0].size(); i++) cur[0][i] = str[0][i];
    for (size_t i = 0; i < str[1].size(); i++)
      cur[str[5].size() - 1][str[0].size() - 1 + i] = str[1][i];
    for (size_t i = 0; i < str[2].size(); i++)
      cur[str[3].size() - 1][i] = str[2][i];
    for (size_t i = 0; i < str[3].size(); i++) cur[i][0] = str[3][i];
    for (size_t i = 0; i < str[4].size(); i++)
      cur[str[3].size() - 1 + i][str[2].size() - 1] = str[4][i];
    for (size_t i = 0; i < str[5].size(); i++)
      cur[i][str[0].size() - 1] = str[5][i];
    bool smaller = true;
    for (size_t i = 0; i < cur.size(); i++) {
      if (i < ret.size() && cur[i] < ret[i])
        break;
      else if (i >= ret.size() || cur[i] > ret[i])
        smaller = false;
    }
    if (smaller) ret = cur;
  } while (next_permutation(str.begin(), str.end()));
  if (ret[0][0] == 127)
    cout << "Impossible\n";
  else {
    for (int i = 0; i < (int)ret.size(); i++) cout << ret[i] << '\n';
  }
  return 0;
}
