#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
template <class T>
T _max(T x, T y) {
  return x > y ? x : y;
}
template <class T>
T _min(T x, T y) {
  return x < y ? x : y;
}
template <class T>
T _abs(T x) {
  return (x < 0) ? -x : x;
}
template <class T>
T _mod(T x, T y) {
  return (x > 0) ? x % y : ((x % y) + y) % y;
}
template <class T>
void _swap(T& x, T& y) {
  T t = x;
  x = y;
  y = t;
}
template <class T>
void getmax(T& x, T y) {
  x = (y > x) ? y : x;
}
template <class T>
void getmin(T& x, T y) {
  x = (x < 0 || y < x) ? y : x;
}
int TS, cas = 1;
const int M = 700000 + 5;
int n;
string str[6];
int a[6], len[6];
struct node {
  int r;
  string str[33];
  bool operator<(const node& t) const {
    for (int i = 0; i < _min(r, t.r); i++) {
      int tmp = str[i].compare(t.str[i]);
      if (tmp < 0) return true;
      if (tmp > 0) return false;
    }
    return r < t.r;
  }
};
node NODE(int _r, string* s) {
  node ret;
  ret.r = _r;
  for (int i = 0; i < _r; i++) ret.str[i] = s[i];
  return ret;
}
vector<node> ret;
bool check() {
  for (int i = 0; i < 6; i++) len[i] = str[a[i]].length();
  if (len[0] + len[5] - 1 != len[3]) return false;
  if (len[1] + len[4] - 1 != len[2]) return false;
  if (str[a[0]][0] != str[a[1]][0]) return false;
  if (str[a[0]][len[0] - 1] != str[a[2]][0]) return false;
  if (str[a[1]][len[1] - 1] != str[a[3]][0]) return false;
  if (str[a[2]][len[1] - 1] != str[a[3]][len[0] - 1]) return false;
  if (str[a[2]][len[2] - 1] != str[a[5]][0]) return false;
  if (str[a[3]][len[3] - 1] != str[a[4]][0]) return false;
  if (str[a[4]][len[4] - 1] != str[a[5]][len[5] - 1]) return false;
  return true;
}
string tmp[33];
int tot;
void addDot(int len) {
  for (int i = 0; i < len; i++) tmp[tot] += '.';
}
void run() {
  int i, j;
  for (i = 0; i < 6; i++) {
    cin >> str[i];
    a[i] = i;
  }
  ret.clear();
  do {
    if (check()) {
      tot = -1;
      tmp[++tot] = "";
      tmp[tot] = str[a[0]];
      addDot(len[3] - len[0]);
      for (i = 1; i < len[1] - 1; i++) {
        tmp[++tot] = "";
        tmp[tot] += str[a[1]][i];
        addDot(len[0] - 2);
        tmp[tot] += str[a[2]][i];
        addDot(len[3] - len[0]);
      }
      tmp[++tot] = "";
      tmp[tot] += str[a[3]];
      for (i = 1; i < len[4] - 1; i++) {
        tmp[++tot] = "";
        addDot(len[0] - 1);
        tmp[tot] += str[a[2]][len[1] - 1 + i];
        addDot(len[3] - len[0] - 1);
        tmp[tot] += str[a[4]][i];
      }
      tmp[++tot] = "";
      addDot(len[0] - 1);
      tmp[tot] += str[a[5]];
      ret.push_back(NODE(len[2], tmp));
    }
  } while (next_permutation(a, a + 6));
  if (ret.size() == 0) {
    puts("Impossible");
    return;
  }
  sort(ret.begin(), ret.end());
  for (i = 0; i < ret[0].r; i++) cout << ret[0].str[i] << endl;
}
void preSof() {}
int main() {
  preSof();
  run();
  return 0;
}
