#include <bits/stdc++.h>
using namespace std;
string temp1[8];
vector<vector<string> > res;
void ans(vector<string> s) {
  long long int l[6];
  vector<string> temp;
  string x;
  for (int i = 0; i < 6; i++) l[i] = s[i].length() - 1;
  if (s[0][0] != s[3][0] || s[0][l[0]] != s[4][0] || s[1][0] != s[3][l[3]] ||
      s[1][l[1]] != s[5][0] || s[2][0] != s[4][l[4]] ||
      s[2][l[2]] != s[5][l[5]] || l[0] + l[2] != l[1] || l[3] + l[5] != l[4] ||
      s[1][l[0]] != s[4][l[3]])
    return;
  for (int i = 0; i <= l[1]; i++) x += '.';
  for (int i = 0; i <= l[4]; i++) temp.push_back(x);
  for (int i = 0; i <= l[0]; i++) temp[0][i] = s[0][i];
  for (int i = 0; i <= l[1]; i++) temp[l[3]][i] = s[1][i];
  for (int i = 0; i <= l[2]; i++) temp[l[4]][l[0] + i] = s[2][i];
  for (int i = 0; i <= l[3]; i++) temp[i][0] = s[3][i];
  for (int i = 0; i <= l[4]; i++) temp[i][l[0]] = s[4][i];
  for (int i = 0; i <= l[5]; i++) temp[l[3] + i][l[1]] = s[5][i];
  res.push_back(temp);
}
int main() {
  for (int i = 0; i < 6; i++) cin >> temp1[i];
  sort(temp1, temp1 + 6);
  vector<string> temp;
  for (int i = 0; i < 6; i++) temp.push_back(temp1[i]);
  ans(temp);
  while (next_permutation(temp1, temp1 + 6)) {
    for (int i = 0; i < 6; i++) temp[i] = temp1[i];
    ans(temp);
  }
  if (res.size() == 0) {
    cout << "Impossible" << endl;
    return 0;
  }
  sort(res.begin(), res.end());
  for (int i = 0; i < res[0].size(); i++) cout << res[0][i] << endl;
  return 0;
}
