#include <bits/stdc++.h>
using ll = long long;
using namespace std;
set<vector<vector<char>>> sols;
bool Put(vector<vector<char>> &board, const string &word, int y, int x,
         int dir) {
  if (dir == 0) {
    for (int i = 0; i < word.length(); i++) {
      if (board[y][x + i] == '.' || board[y][x + 1] == word[i]) {
        board[y][x + i] = word[i];
      } else
        return false;
    }
  } else {
    for (int i = 0; i < word.length(); i++) {
      if (board[y + i][x] == '.' || board[y + i][x] == word[i]) {
        board[y + i][x] = word[i];
      } else
        return false;
    }
  }
  return true;
}
bool Construct(vector<string> &words) {
  int height = words[4].length();
  int width = words[1].length();
  if ((width != words[0].length() + words[2].length() - 1) ||
      height != words[3].length() + words[5].length() - 1)
    return false;
  vector<vector<char>> board(height, vector<char>(width, '.'));
  if (!Put(board, words[0], 0, 0, 0)) return false;
  if (!Put(board, words[1], words[3].length() - 1, 0, 0)) return false;
  if (!Put(board, words[2], words[4].length() - 1, words[0].length() - 1, 0))
    return false;
  if (!Put(board, words[3], 0, 0, 1)) return false;
  if (!Put(board, words[4], 0, words[0].length() - 1, 1)) return false;
  if (!Put(board, words[5], words[3].length() - 1, words[1].length() - 1, 1))
    return false;
  sols.insert(board);
  return true;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  vector<string> words(6);
  for (int i = 0; i < 6; i++) cin >> words[i];
  sort(words.begin(), words.end());
  bool succ = false;
  do {
    Construct(words);
  } while (next_permutation(words.begin(), words.end()));
  if (sols.size() == 0) {
    cout << "Impossible" << '\n';
  } else {
    auto board = *sols.begin();
    for (int i = 0; i < board.size(); i++) {
      for (int j = 0; j < board[i].size(); j++) {
        cout << board[i][j];
      }
      cout << '\n';
    }
  }
  return 0;
}
