#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int l = s.length();
  int lw = 0, rw = 0, fg = 0;
  string lft = "";
  string rt = "";
  for (int i = 0; i < l; i++) {
    if (s[i] == '|')
      fg = 1;
    else if (fg) {
      rw++;
      rt += s[i];
    } else {
      lw++;
      lft += s[i];
    }
  }
  string p;
  cin >> p;
  int pl = p.length();
  int y = rw + pl - lw;
  int y2 = y / 2;
  if (y2 < 0 || pl - y2 < 0)
    cout << "Impossible" << endl;
  else if (y2 * 2 == y) {
    if (lw + y2 == rw + pl - y2) {
      cout << lft;
      for (int i = 0; i < y2; i++) {
        cout << p[i];
      }
      cout << "|" << rt;
      for (int i = y2; i < pl; i++) {
        cout << p[i];
      }
    } else
      cout << "Impossible" << endl;
  } else
    cout << "Impossible" << endl;
  return 0;
}
