#include <bits/stdc++.h>
long long int mod = 1000000007;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s, str;
  cin >> s >> str;
  int flag = 0;
  string left = "", right = "";
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '|')
      flag = 1;
    else if (flag == 0)
      left += s[i];
    else
      right += s[i];
  }
  int l = left.length(), r = right.length();
  for (int i = 0; i < str.length(); i++) {
    if (l > r) {
      right += str[i];
      r++;
    } else {
      left += str[i];
      l++;
    }
  }
  if (left.length() != right.length())
    cout << "Impossible";
  else
    cout << left << "|" << right;
  return 0;
}
