#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  bool b = true;
  int c1 = 0, c2 = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '|')
      b = false;
    else if (b)
      c1++;
    else
      c2++;
  }
  string s1 = s.substr(0, c1), s2 = s.substr(c1 + 1, c2);
  if ((t.length() - abs(c1 - c2)) % 2 || t.length() < abs(c1 - c2))
    cout << "Impossible";
  else {
    for (int i = 0; i < (c1 + c2 + t.length()) / 2 - c1; i++) {
      s1 += t[i];
    }
    for (int i = (c1 + c2 + t.length()) / 2 - c1; i < t.length(); i++) {
      s2 += t[i];
    }
    cout << s1 << "|" << s2;
  }
  return 0;
}
