#include <bits/stdc++.h>
using namespace std;
int n, n2;
string str, str2;
int main() {
  cin >> str >> str2;
  n = str.length();
  n2 = str2.length();
  int i;
  for (i = 0; i < n; i++)
    if (str[i] == '|') break;
  int s1 = i, s2 = n - i - 1;
  bool swa = false;
  if (s1 > s2) {
    swap(s1, s2);
    swa = true;
  }
  if ((s1 + s2 + n2) % 2 == 1) {
    cout << "Impossible" << endl;
    return (0);
  }
  if (s1 + n2 < s2) {
    cout << "Impossible" << endl;
    return (0);
  }
  int n3 = (n + n2) / 2 - s1;
  if (swa) n3 = (n + n2) / 2 - s2;
  for (int i = 0; i < n3; i++) {
    cout << str2[i];
  }
  cout << str;
  for (int i = n3; i < n2; i++) {
    cout << str2[i];
  }
  cout << endl;
  return (0);
}
