#include <bits/stdc++.h>
using namespace std;
vector<int> v;
string ss;
vector<string> s;
char cw[100][100];
int cn, cm;
string mr, r;
char s_first(int i) { return s[v[i]][0]; }
char s_last(int i) { return s[v[i]][s[v[i]].length() - 1]; }
bool is_possible_make_crossword() {
  if (s[v[0]].length() + s[v[2]].length() != s[v[1]].length() + 1) return false;
  if (s[v[3]].length() + s[v[5]].length() != s[v[4]].length() + 1) return false;
  if (s[v[4]][s[v[3]].length() - 1] != s[v[1]][s[v[0]].length() - 1])
    return false;
  if (s_first(1) != s_last(3)) return false;
  if (s_first(0) != s_first(3)) return false;
  if (s_first(4) != s_last(0)) return false;
  if (s_first(5) != s_last(1)) return false;
  if (s_last(5) != s_last(2)) return false;
  if (s_last(4) != s_first(2)) return false;
  return true;
}
void print_v(string s, int si, int sj) {
  for (int i = 0; i < s.length(); i++) cw[si + i][sj] = s[i];
}
void print_g(string s, int si, int sj) {
  for (int i = 0; i < s.length(); i++) cw[si][sj + i] = s[i];
}
string make_crossword() {
  string r = "";
  memset(cw, '.', sizeof(cw));
  print_g(s[v[0]], 0, 0);
  print_g(s[v[1]], s[v[3]].length() - 1, 0);
  print_g(s[v[2]], s[v[4]].length() - 1, s[v[0]].length() - 1);
  print_v(s[v[3]], 0, 0);
  print_v(s[v[4]], 0, s[v[0]].length() - 1);
  print_v(s[v[5]], s[v[3]].length() - 1, s[v[1]].length() - 1);
  for (int i = 0; i < s[v[4]].length(); i++) {
    for (int j = 0; j < s[v[1]].length(); j++) r += cw[i][j];
    r += "\n";
  }
  return r;
}
int main() {
  for (int i = 0; i < 6; i++) {
    v.push_back(i);
    cin >> ss;
    s.push_back(ss);
  }
  int i = 0;
  do {
    if (is_possible_make_crossword()) {
      r = make_crossword();
      if (mr == "")
        mr = r;
      else if (r < mr)
        mr = r;
    }
  } while (next_permutation(v.begin(), v.end()));
  if (mr == "")
    cout << "Impossible";
  else
    cout << mr;
  return 0;
}
