#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int base = 1e9;
const int MAX = 1e5;
const double EPS = 1e-9;
const double PI = acos(-1.);
int main() {
  char x;
  string s1, s2, res;
  vector<char> v(10000);
  int c1, c2, cnt = 0, i = 0;
  cin >> s1 >> s2;
  if ((s1.length() - 1 + s2.length()) % 2 == 1) {
    cout << "Impossible";
    return 0;
  }
  for (int i = 0; i < s1.length(); i++) {
    if (s1.substr(i, 1) == "|") {
      c1 = cnt;
      cnt = 0;
    } else {
      cnt++;
    }
  }
  c2 = cnt;
  if (max(c1, c2) > (s1.length() - 1 + s2.length()) / 2) {
    cout << "Impossible";
    return 0;
  }
  if (c1 > c2) {
    res.append(s2, 0, (s2.length() - (c1 - c2)) / 2);
    res.append(s1);
    res.append(s2, (s2.length() - (c1 - c2)) / 2,
               (s2.length() + (c1 - c2)) / 2);
  } else {
    res.append(s2, 0, (s2.length() + (c2 - c1)) / 2);
    res.append(s1);
    res.append(s2, (s2.length() + (c2 - c1)) / 2,
               (s2.length() - (c2 - c1)) / 2);
  }
  cout << res;
  return 0;
}
