#include <bits/stdc++.h>
using namespace std;
string s, t, a, b;
int main() {
  cin >> s >> t;
  int cnt1 = 0, cnt2 = 0;
  bool was = false;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '|')
      was = true;
    else {
      if (was) {
        b += s[i];
        cnt2++;
      } else {
        a += s[i];
        cnt1++;
      };
    };
  };
  if (abs(cnt2 - cnt1) > t.size() || (t.size() - abs(cnt2 - cnt1)) % 2 == 1)
    printf("Impossible\n");
  else {
    if (cnt1 >= cnt2)
      for (int i = 0; i < cnt1 - cnt2; i++) b += t[i];
    else
      for (int i = 0; i < cnt2 - cnt1; i++) a += t[i];
    int Q = abs(cnt1 - cnt2);
    for (int i = Q; i < t.size(); i++)
      if (i % 2)
        a += t[i];
      else
        b += t[i];
    cout << a << "|" << b << endl;
  };
  return 0;
}
