#include <bits/stdc++.h>
using namespace std;
using namespace std;
int inquire(int x, int y) {
  cout << "? " << x << " " << y << endl;
  int a;
  cin >> a;
  return a;
}
const long long int INF = 0x3f3f3f3f;
const long long int bignum = 1e18;
string s, s1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> s >> s1;
  bool done = false;
  int cnt1 = 0;
  int cnt2 = 0;
  string sub1 = "";
  string sub2 = "";
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '|') {
      done = true;
      continue;
    }
    if (done) {
      cnt2++;
      sub2 += s[i];
    } else {
      cnt1++;
      sub1 += s[i];
    }
  }
  for (int i = 0; i < s1.size(); i++) {
    if (sub1.size() < sub2.size())
      sub1 += s1[i];
    else
      sub2 += s1[i];
  }
  if (sub1.size() != sub2.size())
    cout << "Impossible";
  else
    cout << sub1 << "|" << sub2;
  return 0;
}
