#include <bits/stdc++.h>
using namespace std;
const int NUMBER = 6;
string h1, h2, h3;
string v1, v2, v3;
vector<string> word;
vector<vector<string> > solutions;
void read();
void setSolutions();
bool validSolution();
void setWords(vector<string>);
void debug();
void print();
string toString(vector<string>);
int main() {
  read();
  setSolutions();
  print();
  return 0;
}
void read() {
  for (int i = 0; i < NUMBER; i++) {
    string input;
    cin >> input;
    word.push_back(input);
  }
}
void setSolutions() {
  sort(word.begin(), word.end());
  do {
    if (validSolution()) {
      vector<string> solution;
      for (int i = 0; i < NUMBER; i++) solution.push_back(word[i]);
      solutions.push_back(solution);
    }
  } while (next_permutation(word.begin(), word.end()));
}
bool validSolution() {
  setWords(word);
  if (h1.size() + h3.size() != h2.size() + 1) return false;
  if (v1.size() + v3.size() != v2.size() + 1) return false;
  if (h2[h1.size() - 1] != v2[v1.size() - 1]) return false;
  if (h3[h3.size() - 1] != v3[v3.size() - 1]) return false;
  if (h1[h1.size() - 1] != v2[0]) return false;
  if (v1[v1.size() - 1] != h2[0]) return false;
  if (h2[h2.size() - 1] != v3[0]) return false;
  if (v2[v2.size() - 1] != h3[0]) return false;
  if (h1[0] != v1[0]) return false;
  return true;
}
void setWords(vector<string> w) {
  h1 = w[0];
  h2 = w[1];
  h3 = w[2];
  v1 = w[3];
  v2 = w[4];
  v3 = w[5];
}
void debug() {
  vector<vector<string> >::const_iterator it = solutions.begin();
  cerr << "------------------------------------" << endl;
  while (it < solutions.end()) {
    cerr << toString(*it) << endl;
    cerr << "------------------------------------" << endl;
    it++;
  }
}
void print() {
  vector<vector<string> >::const_iterator it = solutions.begin();
  string answer = "";
  answer += char('Z' + 1);
  while (it < solutions.end()) {
    answer = min(answer, toString(*it));
    it++;
  }
  if (solutions.empty())
    cout << "Impossible" << endl;
  else
    cout << answer << endl;
}
string toString(vector<string> solution) {
  setWords(solution);
  string result = "";
  int len = h2.size();
  string line = h1;
  while (line.size() < len) line += '.';
  result += line;
  result += '\n';
  for (int i = 1; i < v1.size() - 1; i++) {
    line = "";
    line += v1[i];
    for (int j = 2; j < h1.size(); j++) line += '.';
    line += v2[i];
    while (line.size() < len) line += '.';
    result += line;
    result += '\n';
  }
  result += h2;
  result += '\n';
  for (int i = 1; i < v3.size() - 1; i++) {
    line = "";
    for (int j = 1; j < h1.size(); j++) line += '.';
    line += v2[v1.size() + i - 1];
    for (int j = 2; j < h3.size(); j++) line += '.';
    line += v3[i];
    result += line;
    result += '\n';
  }
  for (int i = 1; i < h1.size(); i++) result += '.';
  result += h3;
  return result;
}
