#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  string weights;
  cin >> weights;
  int left = 0, right = 0, ind = 0;
  while (ind < s.size() && s[ind] != '|') left++, ind++;
  right = s.size() - left - 1;
  string a, b;
  a = s.substr(0, left);
  b = s.substr(ind + 1, s.size());
  if (abs(left - right) > weights.size() ||
      (left + right) % 2 ^ weights.size() % 2) {
    cout << "Impossible";
  } else {
    for (int i = 0; i < weights.size(); i++) {
      if (a.size() < b.size())
        a += weights[i];
      else
        b += weights[i];
    }
    cout << a << "|" << b;
  }
  return 0;
}
