#include <bits/stdc++.h>
using namespace std;
int n, n1, pl, pd;
string s, s1, sol;
int main() {
  cin >> s;
  cin >> s1;
  n1 = s1.length();
  n = s.length();
  for (int i = 0; i <= n - 1; i++) {
    if (s[i] == '|') {
      pl = i - 1;
      break;
    }
  }
  pd = n - pl - 2;
  pl++;
  if ((abs(pl - pd) % 2 == 0) && ((n1) % 2 != 0)) {
    printf("Impossible");
    return 0;
  }
  if ((abs(pl - pd) % 2 != 0) && ((n1) % 2 == 0)) {
    printf("Impossible");
    return 0;
  }
  if (n1 + 1 < abs(pl - pd)) {
    printf("Impossible");
    return 0;
  }
  if (pd < pl) {
    for (int i = 0; i <= pl - 1; i++) sol += s[i];
    for (int i = 0; i <= (n1 - abs(pl - pd)) / 2 - 1; i++) {
      sol += s1[i];
    }
    sol += s[pl];
    for (int i = pl + 1; i <= n - 1; i++) sol += s[i];
    for (int i = (n1 - abs(pl - pd)) / 2; i < n1; i++) sol += s1[i];
  } else {
    for (int i = 0; i <= pl - 1; i++) sol += s[i];
    for (int i = 0; i <= abs(pl - pd) - 1; i++) sol += s1[i];
    for (int i = abs(pl - pd); i <= abs(pl - pd) + (n1 - abs(pl - pd)) / 2 - 1;
         i++) {
      if (s1[i] >= 'A' && s1[i] <= 'Z') sol += s1[i];
    }
    sol += s[pl];
    for (int i = pl + 1; i <= n - 1; i++) {
      sol += s[i];
    }
    for (int i = abs(pl - pd) + (n1 - abs(pl - pd)) / 2; i <= n1 - 1; i++)
      if (s1[i] >= 'A' && s1[i] <= 'Z') sol += s1[i];
  }
  cout << sol << endl;
  return 0;
}
