#include <bits/stdc++.h>
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e5 + 5;
const double eps = 1e-9;
using namespace std;
string s[6];
vector<string> ans;
void upd(vector<string> &tmp, int x, int y, int dx, int dy, string s) {
  for (int k = 0; k < s.size(); k++, x += dx, y += dy) tmp[x][y] = s[k];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  for (int i = 0; i < 6; i++) cin >> s[i];
  sort(s, s + 6);
  do {
    if (s[0].size() + s[2].size() != s[1].size() + 1) continue;
    if (s[3].size() + s[5].size() != s[4].size() + 1) continue;
    int len[6];
    for (int i = 0; i < 6; i++) len[i] = s[i].size() - 1;
    if (s[0][0] != s[3][0] || s[0].back() != s[4][0]) continue;
    if (s[1][0] != s[3].back() || s[1][len[0]] != s[4][len[3]]) continue;
    if (s[1].back() != s[5][0] || s[2][0] != s[4].back()) continue;
    if (s[2].back() != s[5].back()) continue;
    int n = len[4] + 1, m = len[1] + 1;
    vector<string> tmp(n, string(m, '.'));
    upd(tmp, 0, 0, 0, 1, s[0]);
    upd(tmp, len[3], 0, 0, 1, s[1]);
    upd(tmp, n - 1, len[0], 0, 1, s[2]);
    upd(tmp, 0, 0, 1, 0, s[3]);
    upd(tmp, 0, len[0], 1, 0, s[4]);
    upd(tmp, len[3], len[1], 1, 0, s[5]);
    if (ans.size() == 0 || ans > tmp) ans = tmp;
  } while (next_permutation(s, s + 6));
  if (ans.size() == 0) cout << "Impossible\n";
  for (string it : ans) cout << it << "\n";
  return 0;
}
