#include <bits/stdc++.h>
static int rows(const std::vector<std::string> &cw) { return cw[2].length(); }
static int cols(const std::vector<std::string> &cw) { return cw[3].length(); }
static bool solution(const std::vector<std::string> &cw) {
  if (cw[0].length() + cw[5].length() != cw[3].length() + 1) return false;
  if (cw[1].length() + cw[4].length() != cw[2].length() + 1) return false;
  return cw[0].front() == cw[1].front() && cw[0].back() == cw[2].front() &&
         cw[1].back() == cw[3].front() &&
         cw[3][cw[0].length() - 1] == cw[2][cw[1].length() - 1] &&
         cw[3].back() == cw[4].front() && cw[2].back() == cw[5].front() &&
         cw[4].back() == cw[5].back();
}
static char chr(const std::vector<std::string> &cw, const int r, const int c) {
  if (r == 0) return c < cw[0].length() ? cw[0][c] : '.';
  if (c == 0) return r < cw[1].length() ? cw[1][r] : '.';
  if (c + 1 == cw[0].length()) return r < cw[2].length() ? cw[2][r] : '.';
  if (r + 1 == cw[1].length()) return c < cw[3].length() ? cw[3][c] : '.';
  if (c + 1 == cw[3].length())
    return r + 1 < cw[1].length() ? '.'
           : r + 1 < cw[1].length() + cw[4].length()
               ? cw[4][r - cw[1].length() + 1]
               : '.';
  if (r + 1 == cw[2].length())
    return c + 1 < cw[0].length() ? '.'
           : c + 1 < cw[0].length() + cw[5].length()
               ? cw[5][c - cw[0].length() + 1]
               : '.';
  return '.';
}
static bool rank(const std::vector<std::string> &a,
                 std::vector<std::string> &b) {
  for (int r = 0; r < std::min(rows(a), rows(b)); r++) {
    for (int c = 0; c < std::min(cols(a), cols(b)); c++)
      if (chr(a, r, c) < chr(b, r, c))
        return true;
      else if (chr(a, r, c) > chr(b, r, c))
        return false;
    if (cols(a) < cols(b))
      return true;
    else if (cols(a) > cols(b))
      return false;
  }
  return rows(a) < rows(b);
}
int main(int argc, char *argv[]) {
  std::vector<std::string> words(6), w;
  std::cin >> words[0] >> words[1] >> words[2] >> words[3] >> words[4] >>
      words[5];
  std::sort(&words[0], &words[6]);
  do
    if (solution(words) && (w.empty() || rank(words, w))) w = words;
  while (std::next_permutation(&words[0], &words[6]));
  if (!w.empty())
    for (int r = 0; r < rows(w); r++, putchar('\n'))
      for (int c = 0; c < cols(w); c++) putchar(chr(w, r, c));
  else
    printf("Impossible\n");
  return EXIT_SUCCESS;
}
