#include <bits/stdc++.h>
using namespace std;
int main() {
  int c = 0, f = 0, s = 0;
  string s1, s2;
  cin >> s1 >> s2;
  string s3, s4;
  for (int i = 0; i < s1.size(); i++) {
    if (s1[i] != '|' && c == 0)
      f++;
    else if (s1[i] == '|')
      c++;
    else
      s++;
  }
  if (((s1.size() - 1) + s2.size()) % 2 == 1 || abs(f - s) > s2.size() ||
      (s2.size() - abs(f - s)) % 2 == 1) {
    cout << "Impossible";
  } else {
    for (int i = 0; i < s1.size(); i++) {
      if (i < f)
        s3 += s1[i];
      else if (i > f)
        s4 += s1[i];
    }
    if (f >= s) {
      for (int i = 0; i < s2.size(); i++) {
        if (i < (f - s) + ((s2.size() - (f - s)) / 2)) {
          s4 += s2[i];
        } else {
          s3 += s2[i];
        }
      }
    } else {
      for (int i = 0; i < s2.size(); i++) {
        if (i < (s - f) + ((s2.size() - (s - f)) / 2)) {
          s3 += s2[i];
        } else {
          s4 += s2[i];
        }
      }
    }
    cout << s3 << '|' << s4;
  }
}
