#include <bits/stdc++.h>
using namespace std;
string s, s2;
int k1, k2, k3, k12, k22, p;
int main() {
  cin >> s;
  k1 = s.find("|", 0);
  k2 = s.length() - k1 - 1;
  cin >> s2;
  k3 = s2.length();
  p = k3;
  if (!((k1 + k2 + k3) % 2 == 0 && max(k1, k2) - min(k1, k2) <= k3))
    cout << "Impossible";
  else {
    if (k1 < k2)
      k12 = k2 - k1;
    else
      k22 = k1 - k2;
    k3 -= k12 + k22;
    k12 += k3 / 2;
    k22 += k3 / 2;
    cout << s.substr(0, k1) << s2.substr(0, k12) << "|" << s.substr(k1 + 1, k2)
         << s2.substr(k12, k22);
  }
  return 0;
}
