#include <bits/stdc++.h>
using namespace std;
long long nn, n, a, m, y, x, z;
string s, ss;
int main() {
  cin >> s;
  nn = 0;
  n = 0;
  x = s.length();
  for (a = 0; a < x; a++) {
    if (s[a] == '|') {
      nn = n;
      n = 0;
    }
    if (s[a] != '|') n++;
  }
  cin >> ss;
  y = ss.length();
  if (nn > n)
    m = nn - n;
  else if (nn < n)
    m = n - nn;
  if (m > y)
    cout << "Impossible" << endl;
  else if (m == y) {
    if (nn > n) {
      cout << s + ss << endl;
    } else if (nn < n) {
      cout << ss + s << endl;
    }
  } else {
    if ((m + y) % 2 == 1)
      cout << "Impossible" << endl;
    else {
      if (nn > n) {
        z = (y - m) / 2;
        for (a = 0; a < z; a++) {
          cout << ss[a];
        }
        cout << s;
        for (a = z; a < z + z; a++) {
          cout << ss[a];
        }
        for (a = z + z; a < y; a++) {
          cout << ss[a];
        }
        cout << endl;
      } else if (nn < n) {
        z = (y - m) / 2;
        for (a = z + z; a < y; a++) {
          cout << ss[a];
        }
        for (a = 0; a < z; a++) {
          cout << ss[a];
        }
        cout << s;
        for (a = z; a < z + z; a++) {
          cout << ss[a];
        }
        cout << endl;
      } else if (nn == n) {
        z = (y - m) / 2;
        for (a = 0; a < z; a++) {
          cout << ss[a];
        }
        cout << s;
        for (a = z; a < z + z; a++) {
          cout << ss[a];
        }
        cout << endl;
      }
    }
  }
  return 0;
}
