#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
int use[6];
vector<int> por;
string s[6];
char ans[35][35];
char ans1[35][35];
int sz1 = 35, sz2 = 35;
void f() {
  for (int w = 0; w < s[por[0]].size(); w++)
    for (int second = 0; second < s[por[1]].size(); second++)
      ans1[w][second] = ans[w][second];
  sz1 = s[por[0]].size();
  sz2 = s[por[1]].size();
}
void solve() {
  if (s[por[0]].size() != s[por[2]].size() + s[por[3]].size() - 1) return;
  if (s[por[1]].size() != s[por[4]].size() + s[por[5]].size() - 1) return;
  if (s[por[1]][s[por[4]].size() - 1] != s[por[0]][s[por[2]].size() - 1])
    return;
  if (s[por[0]][0] != s[por[4]][s[por[4]].size() - 1]) return;
  if (s[por[0]][s[por[0]].size() - 1] != s[por[5]][0]) return;
  if (s[por[4]][0] != s[por[2]][0]) return;
  if (s[por[1]][0] != s[por[2]][s[por[2]].size() - 1]) return;
  if (s[por[1]][s[por[1]].size() - 1] != s[por[3]][0]) return;
  if (s[por[3]][s[por[3]].size() - 1] != s[por[5]][s[por[5]].size() - 1])
    return;
  for (int i = 0; i < 30; i++)
    for (int j = 0; j < 30; j++) ans[i][j] = '.';
  for (int i = 0; i < s[por[0]].size(); i++)
    ans[i][s[por[4]].size() - 1] = s[por[0]][i];
  for (int i = 0; i < s[por[1]].size(); i++)
    ans[s[por[2]].size() - 1][i] = s[por[1]][i];
  for (int i = 0; i < s[por[2]].size(); i++) ans[i][0] = s[por[2]][i];
  for (int i = 0; i < s[por[4]].size(); i++) ans[0][i] = s[por[4]][i];
  for (int i = 0; i < s[por[5]].size(); i++)
    ans[s[por[0]].size() - 1][i + s[por[4]].size() - 1] = s[por[5]][i];
  for (int i = 0; i < s[por[3]].size(); i++)
    ans[i + s[por[2]].size() - 1][s[por[1]].size() - 1] = s[por[3]][i];
  string s1, s2;
  for (int i = 0; i < s[por[0]].size(); i++) {
    if (i >= sz1) return;
    s1.clear();
    s2.clear();
    for (int j = 0; j < s[por[1]].size(); j++) s1 += ans[i][j];
    for (int j = 0; j < sz2; j++) s2 += ans1[i][j];
    if (s1 < s2) {
      f();
      return;
    } else if (s1 > s2)
      return;
  }
}
void calc(int col) {
  if (col == 6) {
    solve();
    return;
  }
  for (int i = 0; i < 6; i++)
    if (!use[i]) {
      use[i] = true;
      por.push_back(i);
      calc(col + 1);
      por.pop_back();
      use[i] = false;
    }
}
int main() {
  string s1;
  for (int i = 0; i < 35; i++)
    for (int j = 0; j < 35; j++) ans1[i][j] = 'Z';
  for (int i = 0; i < 30; i++)
    for (int j = 0; j < 30; j++) ans[i][j] = '.';
  for (int i = 0; i < 6; i++) {
    getline(cin, s1);
    s[i] = s1;
  }
  calc(0);
  if (sz1 == 35) {
    printf("Impossible");
    return 0;
  }
  for (int i = 0; i < sz1; i++) {
    for (int j = 0; j < sz2; j++) printf("%c", ans1[i][j]);
    cout << endl;
  }
  return 0;
}
