Ksenia has ordinary pan scales and several weights of an equal mass. Ksenia has already put some weights on the scales, while other weights are untouched. Ksenia is now wondering whether it is possible to put all the remaining weights on the scales so that the scales were in equilibrium. The scales is in equilibrium if the total sum of weights on the left pan is equal to the total sum of weights on the right pan.

The first line has a non-empty sequence of characters describing the scales. In this sequence, an uppercase English letter indicates a weight, and the symbol "|" indicates the delimiter (the character occurs in the sequence exactly once). All weights that are recorded in the sequence before the delimiter are initially on the left pan of the scale. All weights that are recorded in the sequence after the delimiter are initially on the right pan of the scale.  The second line contains a non-empty sequence containing uppercase English letters. Each letter indicates a weight which is not used yet.  It is guaranteed that all the English letters in the input data are different. It is guaranteed that the input does not contain any extra characters.

If you cannot put all the weights on the scales so that the scales were in equilibrium, print string "Impossible". Otherwise, print the description of the resulting scales, copy the format of the input. If there are multiple answers, print any of them.

var
  s,t : ansistring;
  x1,x2 : longint;
begin
  readln(s);
  readln(t);
  x1:=pos('|',s)-1; x2:=length(s)-pos('|',s);
  while length(t) > 0 do begin
    if x1 < x2 then begin inc(x1); insert(t[1],s,1); end else begin inc(x2); s:=s+t[1]; end;
    delete(t,1,1);
  end;
  if x1 <> x2 then writeln('Impossible') else writeln(s);
end.

var s,ss:ansistring;i,k,kk:longint;f:integer;
function max(a,b:longint):longint;
begin
        if a>b then max:=a
                else max:=b;
end;
function min(a,b:longint):longint;
begin
        if a<b then min:=a
                else min:=b;
end;
begin
        readln(s);
        readln(ss);
        k:=0;
        kk:=0;
        f:=1;
        for i:=1 to length(s) do
        if s[i]='|' then f:=2
                else if f=1 then k:=k+1
                        else if f=2 then kk:=kk+1;
        if max(k,kk)-min(k,kk)>length(ss) then s:='Impossible'
        else
        begin
                if k<kk then
                begin
                        s:=copy(ss,1,kk-k)+s;
                        delete(ss,1,kk-k);
                end
                else
                if k>kk then
                begin
                        s:=s+copy(ss,1,k-kk);
                        delete(ss,1,k-kk);
                end;
                if (length(ss)>0)and(length(ss) mod 2=0) then
                begin
                        s:=copy(ss,1,length(ss) div 2)+s;
                        delete(ss,1,length(ss) div 2);
                        s:=s+ss;
                end
                else if (length(ss)>0)and(length(ss) mod 2=1) then s:='Impossible';
        end;
        writeln(s);
end.

program codeforces_round224_a;

var
  s1, s2 : string;

begin
  readln(s1);
  readln(s2);
  while length(s2) <> 0 do
    begin
      if pos('|', s1) > (length(s1) + 1) div 2
         then s1:=s1 + s2[1]
         else insert(s2[1], s1, 1);
      delete(s2, 1, 1);
    end;
  if pos('|', s1) <> (length(s1) + 1) div 2
     then write('Impossible')
     else write(s1);

end.

Program azkaban;
var s,s1,s2,s3 : string;
    k,i,dif,nr : longint;
begin readln(S);
    i:=1;
    while s[i]<>'|' do begin k:=k+1; i:=i+1; end;
    s1:=copy(s,1,k);
    s2:=copy(s,k+2,length(S)-k-1);
    readln(s3);
    dif:=length(s1)-length(s2);
    if (length(s3)<abs(dif)) then write('Impossible')
                        else
    if ((length(s1)+length(s2)+length(s3)) mod 2<>0) then write('Impossible')
                                  else begin
    i:=1;
    nr:=length(s3);
    while nr <>0 do begin
                            if dif>=0 then begin
                                               s2:=s2+S3[i];
                                               i:=i+1;
                                               nr:=nr-1;
                                               dif:=length(s1)-length(S2);
                                           end
                                      else
                            if dif<0 then begin
                                               s1:=s1+S3[i];
                                               i:=i+1;
                                               nr:=nr-1;
                                               dif:=length(s1)-length(s2);
                                           end;
                             end;
    write(s1,'|',s2);

                     end;

end.

const   fi='';
var
        s,s1:ansistring;

procedure enter;
begin
        assign(input,fi); reset(input);
        readln(s);
        readln(s1);
        close(input);
end;
procedure solve;
var i,w1,w2,n,n1,m:int32; divi:boolean;
begin
        divi:= false;
        w1:= 0; w2:= 0; n:= length(s); n1:= length(s1);
        for i:= 1 to n do
                if s[i]='|' then
                        divi:= true
                else
                if divi then
                        inc(w2)
                else
                        inc(w1);
        m:= (w1+w2+n1) shr 1;
        if ((w1+w2+n1) and 1=1) or( n1+w2<m) or (n1+w1<m) then
                write('Impossible')
        else
        begin
                for i:= 1 to m-w1 do write(s1[i]);
                write(s);
                for i:= m-w1+1 to n1 do write(s1[i]);
        end;
end;
begin
        enter;
        solve;
end.

program Project2;
{$APPTYPE CONSOLE}
uses  SysUtils;

var c: Char;
    i,j,k,l1,l2,dl,l3: integer;
    s1,s2,s3: string;

begin
  s1:='';
   read(c);
   while c<>'|' do
   begin
      s1:=s1+c;
      read(c);
   end;
   Readln(s2);
   L1:=Length(s1);
   L2:=Length(s2);
   Readln(s3);
   l3:=Length(s3);
   dl:=Abs(L1-L2);
   if  (l3>=dl)and ((l1+l2+l3) mod 2=0) then
   begin
      for i:=1 to l3 do
        if Length(s1)<Length(s2) THEN s1:=s1+s3[i] else s2:=s2+s3[i];
        Writeln(s1,'|',s2);
   end
   else  Writeln('Impossible');

end.

var dole,raz,l,d,i,o,po:longint;
a,b,pre,posle,kon:string;
begin
readln (a);
readln (b);
for i:=1 to length(a) do
begin
        if a[i]='|' then
        o:=1
        else
        if o=0 then
        begin
                l:=l+1;
                pre:=pre+a[i];
        end
        else
        begin
                d:=d+1;
                posle:=posle+a[i];
        end;
end;
dole:=length(b);
if (dole+l+d) mod 2=1 then
writeln ('Impossible')
else
begin
        raz:=abs(l-d);
        if raz>dole then
        writeln ('Impossible')
        else
        begin
                kon:=pre+b+posle;
                po:=length(kon) div 2+1;
                insert('|',kon,po);
        end;
end;
writeln (kon);
end.

program project1;

var
  vesy: widestring;
  other: widestring;
  symNum: integer;
  leftSymNum: integer;

begin
  readln(vesy);
  symNum:=Pos('|',vesy);
  readln(other);
  if((Length(vesy)-1+Length(other)) mod 2=1) then
    writeln('Impossible')
  else
  begin
    leftSymNum:=symNum-1-(Length(vesy)-symNum);
    if(abs(leftSymNum)>Length(other)) then
       writeln('Impossible')
    else
    begin
      insert(Copy(other, 1, (Length(other)-leftSymNum) shr 1), vesy, symNum);
      insert(Copy(other, ((Length(other)-leftSymNum) shr 1)+1, Length(other)), vesy, Length(vesy)+1);
      writeln(vesy);
    end;
  end;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  i, n, m, k: integer;
  s, t: string;

begin
{  reset(input, 'input.txt');
  rewrite(output, 'output.txt');}

  readln(s);

  readln(t);

  for i := 1 to length(s) do begin
    if (s[i] = '|') then begin
      n := i - 1;
      m := length(s) - i;
    end;
  end;

  if (abs(n - m) > length(t)) or (abs(n - m) mod 2 <> length(t) mod 2) then begin
    writeln('Impossible');
    halt;
  end;

  k := max(0, m - n) + (length(t) - abs(n - m)) div 2;

  for i := 1 to n do
    write(s[i]);

  for i := 1 to k do
    write(t[i]);

  for i := n + 1 to length(s) do
    write(s[i]);

  for i := k + 1 to length(t) do
    write(t[i]);

end.

program A;
{$APPTYPE CONSOLE}

var
  s1,s2,s11,s22:string;
  x,y,p,z,l,i1,i2:Integer;

begin
  Readln(s1);
  Readln(s2);
  p:=Pos('|',s1);
  s11:=copy(s1,1,p-1);
  s22:=copy(s1,p+1,length(s1)-p);

  while length(s2)>0 do begin
    if Length(s11)=Length(s22) then begin
      s11:=s11+s2[1];
      Delete(s2,1,1);
    end else begin
      if Length(s11)<Length(s22) then begin
        s11:=s11+s2[1];
        Delete(s2,1,1);
      end;
      if Length(s11)>Length(s22) then begin
        s22:=s22+s2[1];
        Delete(s2,1,1);
      end;
    end;
  end;
  if length(s11)=length(s22) then Writeln(s11,'|',s22)
  else writeln('Impossible');

 // Readln;
 // Readln;

end.

label 10;
var
 g,ex,bir,iki:ansistring;
 i,poz:longint;
begin
 readln(g);
 readln(ex);
 for i:=1 to length(g) do
  if g[i]='|' then break
              else bir:=bir+g[i];
 while (i<length(g)) do
  begin
   inc(i);
   iki:=iki+g[i];
  end;
 10:if (length(bir)<length(iki)) then
     if (length(ex)>0) then begin bir:=bir+ex[1]; ex:=copy(ex,2,length(ex)); goto 10; end
                       else begin writeln('Impossible'); halt; end;
    if (length(bir)>length(iki)) then
     if (length(ex)>0) then begin iki:=iki+ex[1]; ex:=copy(ex,2,length(ex)); goto 10; end
                       else begin writeln('Impossible'); halt; end;
 if (length(ex) mod 2=1) then begin writeln('Impossible'); halt; end;
 poz:=length(ex) div 2;
 bir:=bir+copy(ex,1,poz);
 iki:=iki+copy(ex,poz+1,length(ex));
 writeln(bir,'|',iki);
end.

var llength,rlength:shortint;
	x,s:string;
	l,r:array[1..100] of char;
	i,j:longint;
begin
	readln(s);
	i:=1;
	while(s[i]<>'|') do begin
		l[i]:=s[i];
		inc(i);
	end;
	llength:=i-1;
	for i:=llength+2 to length(s) do r[i-llength-1]:=s[i];
	rlength:=length(s)-(llength+1);
	readln(x);
//	writeln(llength,rlength,length(x));
	if ((abs(rlength-llength)>length(x)) or ((length(x)-(rlength-llength)) mod 2 = 1 )) then begin
		write('Impossible');
		halt;
	end;
	for i:=1 to llength do write(l[i]);
	for i:=1 to (llength+rlength+length(x)) div 2 - llength do write(x[i]);
	j:=(llength+rlength+length(x)) div 2 - llength;
	write('|');
	for i:=1 to rlength do write(r[i]);
	for i:=1 to (llength+rlength+length(x)) div 2 - rlength do write(x[j+i]);
end.

var s1,s2:string;
    ch1,ch2:string;
    i,f,a,b:longint;
begin
readln(s1);
readln(s2);
for i:=1 to pos('|',s1)-1 do ch1:=ch1+s1[i];
for i:=1+pos('|',s1) to length(s1) do ch2:=ch2+s1[i];
a:=length(ch1);
b:=length(ch2);
while (s2<>'')  do
 begin
 if (a>b) AND (S2<>'') then begin inc(b); ch2:=ch2+s2[1]; delete(s2,1,1);  end;
 if (b>a) AND (S2<>'') then begin inc(a); ch1:=ch1+s2[1]; delete(s2,1,1);  end;
 if (a=b) and (s2<>'') then begin inc(a); ch1:=ch1+s2[1]; delete(s2,1,1);  end;
 end;
if length(ch1)=length(ch2) then write(ch1,'|',ch2)
                           else write('Impossible');
end.

program ProblemA;
var s,l,r:ansistring;
    i,j:longint;
    c:char;
begin
  repeat
    read(c);
  l:=l+c;
    until c=#124;
  delete(l,length(l),1);
  readln(r);

  readln(s);
  for i:=1 to length(s) do
    if length(l)<=length(r)  then l:=l+s[i] else r:=r+s[i];
  if length(l)<>length(r) then write('Impossible')
     else write (l,#124,r);
readln;
end.

var  t,n,i,c,d:integer;a,b,t1,t2:string;
begin readln(a);readln(b);n:=length(a);
t:=pos('|',a);
t2:=copy(a,t+1,n);
t1:=copy(a,1,t-1);
c:=length(b);
d:=length(t1)-length(t2);
if ((d-c) mod 2<>0) or (abs(d)>c) then begin writeln('Impossible');halt;end;

for i:=1 to length(b) do
if length(t1)<length(t2) then t1:=b[i]+t1 else t2:=t2+b[i];
write(t1,'|',t2);

end.

program Project2;
{$APPTYPE CONSOLE}
var m:array[1..1250] of integer;
var n,d,i,max,j:integer;
var s,ds:string;
begin
 readln(s);
 readln(ds);
 while ds<>'' do
  begin
   i:=pos('|',s)-1;
   if i<length(S)-i-1
   then s:=ds[1]+s
   else s:=s+ds[1];
   delete(ds,1,1);
  end;
 i:=pos('|',s)-1;
 if i=length(S)-i-1
 then writeln(s)
 else writeln('Impossible');
 readln(i);
end.

uses math;

var s,d:string;
    i,l,l1,t:byte;

begin
readln(s);
l:=length(s);
i:=1;
while s[i]<>'|' do
inc(i);
read(d);
l1:=length(d);
if (l1<abs(i-1-l+i)) or ((l1-abs(2*i-l-1)) mod 2=1) then
begin
write('Impossible');
halt;
end;

t:=trunc((l1-abs(2*i-l-1))/2);
if 2*i-l-1<0 then
t:=t-(2*i-l-1);
for i:=1 to t do
write(d[i]);
write(s);
if t>0 then inc(i);
for t:=i to l1 do
write(d[t]);
end.

var
a,c,s:string;
b,d,e,f,g,h,i,j,k,x,y,z:longint;
tabel:array[1..100] of ansistring;
data:array[1..100] of longint;
begin
	s:='';
	readln(a);
	b:=length(a);
	x:=1;
	y:=1;
	data[1]:=0;
	data[2]:=0;
	tabel[1]:='';
	tabel[2]:='';
	for i:=1 to b do
	begin
		if a[i]<>'|' then
		begin
			data[x]:=data[x]+1;
			tabel[x]:=tabel[x]+a[i];
		end
		else
		begin
			x:=x+1;
			e:=i-1;
		end;
	end;
//	writeln(tabel[1],' ',tabel[2],' ',length(tabel[1]),' ',length(tabel[2]));
	readln(c);
	d:=length(c);
	f:=abs(data[1]-data[2]);
	g:=d-f;
	h:=length(tabel[1]);
	z:=length(tabel[2]);
	if (g mod 2=1) or (g<0) then
	write('Impossible')
	else
	begin
		if z>h then
		begin
			for j:=1 to(z-h)+(d-(z-h))div 2 do
			begin
				s:=s+c[y];
				y:=y+1;
			end;
			s:=s+tabel[1];
			s:=s+'|';
			s:=s+tabel[2];
			for k:=1 to (d-(h-z))div 2 do
			begin
				s:=s+c[y];
				y:=y+1;
			end;
		end
		else
		begin
			for j:=1 to(d-(h-z))div 2 do
			begin
				s:=s+c[y];
				y:=y+1;
			end;
			s:=s+tabel[1];
			s:=s+'|';
			s:=s+tabel[2];
			for k:=1 to (h-z)+(d-(h-z))div 2 do
			begin
				s:=s+c[y];
				y:=y+1;
			end;
		end;
	end;
	for i:=1 to length(s) do
	begin
		if (((s[i]>='a') and (s[i]<='z')) or ((s[i]>='A') and (s[i]<='Z')) or (s[i]='|')) then write(s[i]);
	end;
	writeln;
end.

var
  s,t,ans1,ans2:ansistring;
  x,y,sum:longint;
begin
  readln(s);
  readln(t);
  x:=pos('|',s)-1;
  y:=length(s)-x-1;
  sum:=length(t);
  ans1:=copy(s,1,x);
  ans2:=copy(s,x+2,length(s)-x+2);
  while (sum>0) do
    begin
      if (x>y) then begin
                      inc(y);
                      ans2:=ans2+t[sum];
                      dec(sum);
                    end
      else begin
             inc(x);
             ans1:=ans1+t[sum];
             dec(sum);
           end;
    end;
  if (x=y) then write(ans1,'|',ans2)
  else write('Impossible');
end.

var
 s,res,t,gg1,gg2:string;
 g1,g2,go,i,n,j:longint;
begin
 readln(s);
 readln(t);
 i:=1;
 gg1:='';
 gg2:='';
 while (s[i]<>'|') do
  begin
   gg1:=gg1+s[i];
   i:=i+1;
  end;
 for j:=i+1 to length(s) do
  gg2:=gg2+s[j];
 n:=abs(length(gg1)-length(gg2));
 go:=length(t)-abs(length(gg1)-length(gg2));
 if (go mod 2<>0)or(go<0) then
  begin
  writeln('Impossible');
  exit;
  end else
 begin
  if (length(gg1)<length(gg2)) then
  begin
   for i:=1 to (length(gg2)-length(gg1)) do
    gg1:=gg1+t[i];
   end else
  if (length(gg2)<length(gg1)) then
   for i:=1 to (length(gg1)-length(gg2)) do
    gg2:=gg2+t[i];
 end;
 go:=n+1;
 for i:=go to length(t) do
  if i mod 2<>0 then gg1:=gg1+t[i] else gg2:=gg2+t[i];
 writeln(gg1,'|',gg2);
end.

var s,a:string;
    l,r,x,i:integer;
begin
    readln(s);
    l:=pos('|',s)-1;
    r:=length(s)-l-1;
    readln(a);
    x:=length(a);
    if ((l+r+x)mod 2=1)or(x+r<l)or(x+l<r)then
        writeln('Impossible')
    else begin
        for i:=1 to l do
            write(s[i]);
        for i:=1 to ((l+r+x)div 2-l)do
            write(a[i]);
        write('|');
        for i:=(l+2) to (l+r+1) do
            write(s[i]);
        for i:=x downto ((l+r+x)div 2-l+1) do
            write(a[i]);
    end;
    readln;
end.

var
s,s1,s2,s3,ss:ansistring;
l,l1,i,k,l2,l3,p,o:longint;
begin
readln(s);
read(s1);
l:=length(s);
l1:=length(s1);
for i:=1 to l do
begin
  if (s[i]='|') then
  begin
  k:=i;
  break;
  end;
end;
s2:=copy(s,1,k-1);
s3:=copy(s,k+1,l-k);
l2:=k-1;
l3:=l-k;
p:=l1-abs(l2-l3);
if  (p mod 2=0) and (p>=0) then
begin
  write(s2);
  if (l3>=l2) then
  begin
    o:=l3-l2;
    ss:=copy(s1,1,o);
    write(ss);
    ss:=copy(s1,o+1,p div 2);
    write(ss);
    write('|');
    write(s3);
    ss:=copy(s1,o+1+(p div 2), p div 2);
    write(ss);

  end
  else
  begin
    o:=l2-l3;
    ss:=copy(s1,1,o);
    s3:=s3+ss;

    ss:=copy(s1,o+1,p div 2);
    write(ss);
    write('|');
    write(s3);
    ss:=copy(s1,o+1+(p div 2), p div 2);
    write(ss);

  end;
end
else
begin
write('Impossible');
end;
end.

type    int     =       longint;
var     l,r,x,p :       int;
        s,st    :       string;
begin
        //ASSIGN(INPUT,'A.IN'); RESET(INPUT);
        readln(s);
        p := pos('|',s);
        l := p-1;
        r := length(s)-p;
        readln(st);
        x := length(st);
        //CLOSE(INPUT);
        if ((l+r+x)mod 2<>0)or(l>r+x)or(l+x<r) then writeln('Impossible') else
           begin
                 while l>r do
                    begin
                          s := s + st[1]; r := r + 1;
                          delete(st,1,1);
                    end;
                 while l<r do
                    begin
                          s := st[1] + s; l := l+1;
                          delete(st,1,1);
                    end;
                 s := s + copy(st,1, length(st) div 2);
                 delete(st,1,length(st) div 2);
                 s := st + s;
                 writeln(s);
           end;
end.

Var s1,s2:string;
j,i:longint;
begin
   // Assign(input,'input.txt'); reset(input);
   // Assign(output,'output.txt'); rewrite(output);
    readln(s1);
    readln(s2);
    if (length(s1)+length(s2)-1) mod 2=1
    then writeln('Impossible')
    else begin
          j:=(length(s1)+length(s2)-1) div 2;
          if (pos('|',s1)-1>j)or(length(s1)-pos('|',s1)>j)
          then writeln('Impossible')
          else begin
                j:=j-(pos('|',s1)-1);
                for i:=1 to j do
                s1:=s2[i]+s1;
                for i:=j+1 to length(s2) do
                s1:=s1+s2[i];
                writeln(s1);
               end;
         end;
end.

uses sysutils;
var a,b,s:string;
	t:integer;

begin
	readln(s);
	t:=pos('|',S);
	a:=copy(s,1,t-1);
	delete(s,1,t);
	b:=s;
	readln(s);
	while s<>'' do
	begin
		if length(a) < length(b) then a:=a+s[1]
		else
			b:=b+s[1];
		delete(s,1,1);
	end;
	if length(a)<>length(b) then write('Impossible')
	else
		write(a,'|',b);
end.

var s,f,s2,s1:string;
x:longint;
begin
readln(s);
//s:='AC|T';
readln(f);
x:=pos('|',s);
s1:=copy(s,1,x-1);
s2:=copy(s,x+1,length(s)-x);
while length(f)<>0 do begin
                      if length(s1)<length(s2) then s1:=s1+f[1] else s2:=s2+f[1];
                      delete(f,1,1);
                      end;
if length(s1)=length(s2) then write(s1,'|',s2) else write('Impossible');
end.

var a,b,c,d,l,kl,kp,p,s,pp : longint;
r,r2,rl,rp : string;
begin
readln (r);
kl:=pos('|',r)-1;
kp := length(r)-pos('|',r);
pp:=pos('|',r)+1;
rl:=copy (r,1,kl);
rp:=copy (r,pp,kp);
readln (r2);
for a := 1 to length (r2) do
if kl<=kp then begin rl:=rl+r2[a]; inc (kl); end
else begin rp:=rp+r2[a]; inc (kp); end;
if kl<>kp then writeln ('Impossible')
else writeln (rl,'|',rp);
end.

 var q,s:string;
  a,b,n1,m,k,n:longint;

begin
readln(s);
readln(q);
n:=length(s);
k:=pos('|',s)-1;
m:=n-k-1;
a:=abs(k-m);
n1:=length(q);
b:=n1-a;
if (b<0) or(odd(b))then
write('Impossible') else
begin
if k<m  then
      begin
  write(COPY(q,1,M-K+b div 2),S);
    delete(q,1,M-K+b div 2)  ;
write(q);   end else
begin
    write(COPY(q,1,b div 2),S);
    delete(q,1,b div 2)  ;
write(q);
end;
end;
       READLN
  { TODO -oUser -cConsole Main : Insert code here }
end.

{$mode objFpc}{$H+}
uses math;
const
                finp            =               '';
                fout            =               '';
var
                fi,fo           :               text;
                S,S1,S2,T       :               String;
procedure openfile;
begin
        assign(fi,finp);reset(fi);
        assign(fo,fout);rewrite(fo);
end;
procedure closefile;
begin
        close(fi);close(fo);
end;
procedure enter;
var
        i               :               integer;
begin
        readln(fi,S);
        readln(fi,T);
        i:=pos('|',S);
        S1:=Copy(S,1,i-1);
        S2:=Copy(S,i+1,length(S)-i);
end;
procedure process;
var
        i,T1,T2,T3,j,k  :               integer;
begin
        T1:=length(S1);T2:=length(S2);T3:=length(T);
        if (Abs(T1-T2)<=T3) and (not odd(T3-abs(T1-T2))) then
        begin
                j:=abs(T1-T2);
                k:=(T3-abs(T1-T2)) div 2;
                if T1<T2 then
                        S1:=S1+Copy(T,1,j)
                else
                        S2:=S2+Copy(T,1,j);
                if k>0 then
                begin
                        S1:=S1+Copy(T,j+1,k);
                        S2:=S2+Copy(T,j+k+1,k);
                end;
                writeln(fo,S1,'|',S2);
        end
        else
                writeln(fo,'Impossible');
end;
begin
        openfile;
        enter;
        process;
        closefile;
end.

{$r-,s-,q-,i-,o+}
var
  s,t:ansistring;
  v1,v2,i:longint;
begin
  readln(s);
  v1:=pos('|',s)-1;
  v2:=length(s)-v1-1;
  readln(t);
  for i:=0 to length(t) do
    if (v1+i=v2+length(t)-i) then
      begin
        writeln(copy(t,1,i),s,copy(t,i+1,length(t)-i));
        halt(0);
      end;
  writeln('Impossible');
end.

VAR a,b,c,d:integer;t,t1,t2,n:string[255];
begin
readln(t);
b:=pos('|',t);
t1:=copy(t,1,b-1);
t2:=copy(t,b+1,length(t)-b);
readln(n);
c:=length(n);
d:=length(t1)-length(t2);
if ((d-c) mod 2<>0) or (abs(d)>c) then writeln('Impossible') else
begin
writeln(t1,copy(n,1,(c-d) div 2),'|',t2,copy(n,(c-d) div 2+1,c));
end;
end.

var
s,q,aa,bb:ansistring;
ss,i,j,k:Longint;
now,a,b:Longint;

begin
	readln(s);
	for i:=1 to length(s) do
	begin
		if s[i]<>'|' then
		begin
			inc(a);
			aa:=aa+s[i];
		end
		else
		begin
			ss:=i;
			break;
		end;
	end;
	for i:=ss to length(s) do
	begin
		if s[i]<>'|' then
		begin
			inc(b);
			bb:=bb+s[i];
		end;
	end;
	readln(q);
//	writeln(a,' ',b);
	for i:=1 to length(q) do
	begin
		if a>b then inc(b) else inc(a);
	end;
//	writeln(a,' ',b);
	now:=1;

	if (a=b) then
	begin
		for i:=1 to length(aa) do
		begin
			write(aa[i]);
		end;
		for i:=1 to abs(length(aa)-a) do
		begin
			write(q[i]);
			inc(now);
		end;
		write('|');
		for i:=1 to length(bb) do
		begin
			write(bb[i]);
		end;
		for i:=now to length(q) do
		begin
			write(q[i]);
			inc(now);
		end;
		writeln;
	end
	else writeln('Impossible');
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,math;

var a,b:string;
    i,p,r,j,count,p1,p2,need, needa, needb:longint;

procedure outt;
begin
    writeln('Impossible');
    close(output);
    halt;
 end;

begin
//assign(input,'input.txt');
//assign(output,'output.txt');
//reset(input);
//rewrite(output);

readln(a);
p:=pos('|',a);
//writeln(p);
p1:=0; p2:=0;
for i:=1 to p-1 do inc(p1);
for i:=p+1 to length(a) do inc(p2);
//writeln(p1,' ',p2);
//if (p1<>p2) then outt;
readln(b);
if ((p1+p2+length(b)) mod 2=1) then outt;
need:=(p1+p2+length(b)) div 2;
j:=1;
needa:=need-p1;
needb:=need-p2;
//if (needa<>needb) then outt;
for i:=1 to needb do
 begin
 if (j>length(b)) then break;
 insert(b[j],a,p+1);
 inc(j);
 end;

for i:=1 to needa do
 begin
 if (j>length(b)) then break;
 insert(b[j],a,p-1);
 inc(j);
 end;
p:=pos('|',a);
p1:=0;
p2:=0;
for i:=1 to p-1 do inc(p1);
for i:=p+1 to length(a) do inc(p2);
if (p1<>p2) then outt;
writeln(a);

//close(input);
//close(output);
end.

Const
  infile = '';
  outfile = '';
Var
  str1, str2, st1, st2: Ansistring;
  ch: Char;
  l1, l2, l3, i, l: Longint;
  f: Boolean;
Begin
  Assign(input, infile);
  Reset(input);
  Assign(output, outfile);
  Rewrite(output);
  ReadLn(st1);
  ReadLn(st2);
  l := length(st1);
  f := True;
  For i:=1 To l Do Begin
    If st1[i] = '|' Then Begin
      f := False;
      continue;
    End;
    If f Then str1 := str1 + st1[i]
    Else str2 := str2 + st1[i];
  End;
  l1 := length(str1);
  l2 := length(str2);
  l3 := length(st2);
  For i:=1 To l3 Do Begin
    ch := st2[i];
    If l1 <= l2 Then Begin
      Inc(l1);
      str1 := str1 + ch;
      Continue;
    End;
    If l1 > l2 Then Begin
      Inc(l2);
      str2 := str2 + ch;
    End;
  End;
  If l1 = l2 Then Writeln(str1, '|', str2)
  Else WriteLn('Impossible');
  Close(input);
  Close(output);
End.

//382 A

var
	a,b,temp : string;
	kanan,kiri : longint;

function min(a,b : longint): longint;
begin
	if(a > b) then min := b
	else min := a;
end;

function max(a,b : longint) : longint;
begin
	if(a > b) then max := a
	else max := b;
end;

begin
	readln(a); readln(b);
	kiri := pos('|',a) - 1;
	kanan := length(a) - pos('|',a);
	if((length(a)-1+ length(b)) mod 2 = 1) then begin
		writeln('Impossible');
		halt(0);
	end else if(min(kanan,kiri) + length(b) < max(kanan,kiri)) then begin
		writeln('Impossible');
		halt(0);
	end else if(kiri < kanan) then begin
		temp := b;
		delete(temp,kanan-kiri+1,length(temp)-kanan+kiri);
		delete(b,1,kanan-kiri);
		insert(temp,a,1);
	end else begin
		temp := b;
		delete(temp,kiri-kanan+1,length(temp)-kiri+kanan);
		delete(b,1,kiri-kanan);
		insert(temp,a,length(a)+1);
	end;
	temp := b;
	delete(temp,length(temp) div 2 + 1,length(temp) div 2);
	delete(b,1,length(b) div 2);
	insert(temp,a,1);
	insert(b,a,length(a)+1);
	writeln(a);
end.

  var s,s1:ansistring;
      i,k1,k2,k3:longint;
      u:byte;

begin s:='';
   readln(s);
   u:=0; s1:=''; k1:=0;k2:=0;
    for i:=1 to length(s) do
      begin
       if s[i]='|' then u:=1;
       if s[i] in ['A'..'Z'] then if u=0 then inc(k1)
                                         else inc(k2);
      end;
     readln(s1); k3:=length(s1);
              i:=1;
     if ((k3+k2+k1) mod 2 = 1) or (k1>k2+k3) or (k2>k3+k1) then writeln('Impossible')
                             else begin
                                   while k3<>0 do
                                    begin
                                     if k1>k2 then begin s:=s+s1[i]; inc(i);inc(k2); dec(k3); end
                                              else begin write(s1[i]); inc(k1); inc(i); dec(k3); end;
                                    end;
                                    write(s);
                                  end;

  readln;
{Totusi este trist in lume}
end.

program task_one;

var i : longint;
was : boolean;
s : ansistring;
a, b : ansistring;
begin
	Readln(s);
	was:=false;
	a:=''; b:='';
	for i:=1 to length(s) do begin
		if s[i]<>'|' then begin
			if not was then a:=a + s[i]
			else b:=b + s[i];
		end else was:=true;
	end;
	s:='';
	Readln(s);
	for i:=1 to length(s) do begin
		if length(a)<=length(b) then begin
			a:=a + s[i];
		end else begin
			b:=b + s[i];
		end;
	end;
	if length(a)<>length(b) then Writeln('Impossible')
	else Writeln(a,'|',b);
end.

var a,b:ansistring;
    i,l,r,l1,r1:longint;
begin
readln(a);
readln(b);
l:=0;
while (a[l+1]<>'|') do inc(l);
r:=length(a)-l-1;
l1:=r-l+length(b);
r1:=-r+l+length(b);
if ((l1<0)or(r1<0)or(l1 mod 2=1) or (r1 mod 2=1)) then writeln('Impossible')
else begin
        for i:=l1 div 2 downto 1 do a:=b[i]+a;
        for i:=l1 div 2+1 to length(b) do a:=a+b[i];
        writeln(a);
        end;
end.

var
s:string;
n,k,ans,top,center :longint;
a :array of char;

procedure intap;
var
i :longint;
begin
top:=0;
for i:=1 to 10000 do begin
Setlength(a,i+1);
read(a[i]);
if a[i]='|' then center:=i;
if ord(a[i]) <65 then break;
Inc(top);

end;
readln();
read(s);
Ans:= Abs((top-center )-(center-1))  ;

if (Length(s)<Ans) or ( (Length(s)-Ans) mod 2 <> 0) then write('Impossible')
else begin
if top-center > center-1    then k:=2 else k:=1;
if k=2 then begin
        for i:=1 to center-1 do write(a[i]);
        for i:=1 to Ans do write(s[i]);
           if Ans<Length(s) then begin
                for i:=Ans+1 to ((Length(s)-Ans) div  2)+Ans do write(s[i]);
            write('|');
            for i:=center+1 to top do write (a[i]);
            for i:=Ans+((Length(s)-Ans) div  2)+1 to Length(s) do write(s[i]);
          end else    begin  write('|');for i:=center+1 to top do write (a[i]); end;
          end;
         end;

if k=1 then begin

   for i:=1 to center-1 do write(a[i]);
           if Ans<Length(s) then begin
                for i:=Ans+1 to ((Length(s)-Ans) div  2)+Ans do write(s[i]);
            write('|');
            for i:=center+1 to top do write (a[i]);
              for i:=1 to Ans do write(s[i]) ;
                 for i:=Ans+(( Length(s)-Ans) div  2)+1 to Length(s) do write(s[i]);
          end else    begin write('|');for i:=center+1 to top do write (a[i]);
     for i:=1 to Ans do write(s[i]);
          end;
          end;
         end;

begin
intap;
end.

var s1,s2:string;
    i,l:byte;

BEGIN
readln(s1);readln(s2);
i:=1;
while s1[i]<>'|' do i:=i+1;
l:=length(S1);
while ((length(s1)-i<>i-1) or (length(s2)>1))and(length(s2)>0) do
        begin
        if length(s1)-i=i-1 then
                begin
                s1:=s2[1]+s1+s2[2];
                delete(s2,1,2);
                i:=i+1;
                end
        else if length(s1)-i<i-1 then
                begin
                s1:=s1+s2[1];
                delete(s2,1,1);
                end
        else if length(s1)-i>i-1 then
                begin
                s1:=s2[1]+s1;
                delete(s2,1,1);
                i:=i+1;
                end;
        end;
if odd(length(s1)) and (i=length(s1) div 2+1) and (l<>length(s1)) and (length(s2)=0) then write(s1) else write('Impossible');
END.

var s,s1,s2,sg:ansistring;
    i,t1,t2:longint;
begin
readln(s);
readln(sg);
i:=1;
while s[i]<>'|' do inc(i);
s1:=copy(s,1,i-1);
s2:=copy(s,i+1,length(s)-i);
while length(sg)>0 do begin
 if length(s1)>length(s2) then s2:=s2+sg[1] else s1:=s1+sg[1];
 delete(sg,1,1);end;
if length(s1)=length(s2) then writeln(s1+'|'+s2) else writeln('Impossible');
end.

var s,p:string; a,b,c,k:byte;
begin
    readln(s); readln(p);
    a:=pos('|',s)-1; b:=length(s)-pos('|',s); c:=length(p);

    if ((a+b+c) mod 2=0) then
    begin
        if (c>=abs(a-b)) then
        begin
            k:=c-a+b;
            writeln(copy(p,1,k div 2),s,copy(p,k div 2+1,c-k div 2))
        end else writeln('Impossible');
    end else writeln('Impossible');
end.

program A;
{$APPTYPE CONSOLE}

var
  s1,s2,s11,s22:string;
  x,y,p,z,l,i1,i2:Integer;

begin
  Readln(s1);
  Readln(s2);
  p:=Pos('|',s1);
  s11:=copy(s1,1,p-1);
  s22:=copy(s1,p+1,length(s1)-p);

  while length(s2)>0 do begin
    if Length(s11)=Length(s22) then begin
      s11:=s11+s2[1];
      Delete(s2,1,1);
    end else begin
      if Length(s11)<Length(s22) then begin
        s11:=s11+s2[1];
        Delete(s2,1,1);
      end;
      if Length(s11)>Length(s22) then begin
        s22:=s22+s2[1];
        Delete(s2,1,1);
      end;
    end;
  end;
  if length(s11)=length(s22) then Writeln(s11,'|',s22)
  else writeln('Impossible');

 // Readln;
 // Readln;

end.

program project1;

var
  vesy: widestring;
  other: widestring;
  symNum: integer;
  leftSymNum: integer;

begin
  readln(vesy);
  symNum:=Pos('|',vesy);
  readln(other);
  if((Length(vesy)-1+Length(other)) mod 2=1) then
    writeln('Impossible')
  else
  begin
    leftSymNum:=symNum-1-(Length(vesy)-symNum);
    if(abs(leftSymNum)>Length(other)) then
       writeln('Impossible')
    else
    begin
      insert(Copy(other, 1, (Length(other)-leftSymNum) shr 1), vesy, symNum);
      insert(Copy(other, ((Length(other)-leftSymNum) shr 1)+1, Length(other)), vesy, Length(vesy)+1);
      writeln(vesy);
    end;
  end;
end.

var i,t1,t2,q,r :longint;
   s1,s2,ss1,ss2,ss:string;
   ok:boolean;
  begin
    readln(s1);
    readln(s2);
    ok:=false;
    for i:=1 to length(s1) do
     begin
      if (s1[i]='|') then begin ok:=true; continue; end;
      if ok then begin inc(t2); ss2:=ss2+s1[i] end
      else begin inc(t1); ss1:=ss1+s1[i];end;
     end;

    if t1<t2 then begin
                     q:=t2-t1;
                     if q>length(s2) then begin writeln('Impossible'); halt; end;
                     for i:=1 to q do
                      ss1:=ss1+s2[i];
                     if (length(s2)-q) mod 2=0 then begin
                                                      r:=(length(s2)-q) div 2;
                                                      if r<>0 then begin
                                                      for i:=q+1 to q+r do
                                                       ss1:=ss1+s2[i];
                                                       for i:=q+r+1 to length(s2) do
                                                        ss2:=ss2+s2[i];
                                                        end;
                                                      ss:=ss1+'|'+ss2;
                                                      writeln(ss);
                                                      halt;
                                                    end
                                                    else begin writeln('Impossible'); halt; end;
                  end
     else begin
     q:=t1-t2;
            if q>length(s2) then begin writeln('Impossible'); halt; end;
                     for i:=1 to q do
                      ss2:=ss2+s2[i];
                     if (length(s2)-q) mod 2=0 then begin
                                                      r:=(length(s2)-q) div 2;
                                                      if r<>0 then begin
                                                      for i:=q+1 to q+r do
                                                       ss2:=ss2+s2[i];
                                                       for i:=q+r+1 to length(s2) do
                                                        ss1:=ss1+s2[i];
                                                        end;
                                                      ss:=ss1+'|'+ss2;
                                                      writeln(ss);
                                                      halt;
                                                    end
                                                    else begin writeln('Impossible'); halt; end;
          end;
  end.

var s,s2,s3:string; r,i,l,n,k,sum:integer;
begin
//  reset(input,'input.txt');
//  assign(output,'output.txt');
  readln(s);
  s2:=s;
  l:=0;
  r:=0;
  n:=length(s);
  i:=1;
  while s[i]<>'|' do
    inc(i);
  l:=i-1;
  r:=n-i;
  read(s);
  s3:=s;
  n:=length(s);
  sum:=n+r+l;
  if (sum)mod 2<>0
  then write('Impossible')
  else begin
        sum:=sum div 2;
        if (sum<l)or(sum<r)
        then write('Impossible')
        else begin
              i:=1;
              while s2[i]<>'|' do
                begin
                  write(s2[i]);
                  inc(i);
                end;
              k:=i;
              i:=1;
              while l<sum do
                begin
                  write(s3[i]);
                  inc(i);
                  inc(l);
                end;
              write('|');
              while k<>length(s2) do
                begin
                  inc(k);
                  write(s2[k]);
                end;
              while i<=length(s3) do
                begin
                  write(s3[i]);
                  inc(i);
                end;
             end;
       end;
end.

Var k1,k2,k3,sum,i:longint;
s,s1:string;
begin
readln(s);
k1:=pos('|',s)-1;
k2:=length(s)-pos('|',s);
readln(s1);
k3:=length(s1);
sum:=k1+k2+k3;
if (k1+k2+k3) mod 2<>0 then writeln('Impossible') else
begin
if (k1<=sum div 2) and (k2<=sum div 2) then begin
for i:=1 to sum div 2-k1 do
write(s1[i]);
write(s);
for i:=sum div 2-k1+1 to length(s1) do
write(s1[i]);
end else writeln('Impossible'); end;
end.

program yan;
  var s,s1:ansistring;
      i,j,x,y,a,b,n,m:longint;
begin
  readln(s);
  read(s1);
  for i:=1 to length(s) do
    begin
      if s[i]='|' then begin x:=1; continue; end;
      if (x=0) then inc(a) else inc(b);
    end;
  if abs(a-b)>length(s1) then begin write('Impossible'); exit; end;
  if a>b then
    while b<a do
      begin
        inc(j);
        s:=s+s1[j];
        inc(b);
      end
  else
    while a<b do
      begin
        inc(j);
        s:=s1[j]+s;
        inc(a);
      end;
  if (length(s1)-j) mod 2<>0 then begin write('Impossible'); exit; end;
  for i:=j+1 to length(s1) do
    if i mod 2<>0 then s:=s+s1[i] else s:=s1[i]+s;
  write(s);
end.

Var i,j,k,l,n,m,t,c,r,f,x : Longint;
    s,s1 : ansistring;
function Max(a,b : Longint) : Longint;
begin
   If (a > b) Then max := a
   else max := b;
End;

Begin
   Readln(s);
   i := 1;
   While s[i] <> '|' Do
     Begin
        Inc(l);
        inc(i);
     End;
   r := length(s) - l - 1;
   Readln(s1);
   c := abs(r - l);
   if (length(s1) - c < 0) or ((length(s1) - c) mod 2 <> 0) Then
        Begin
           Writeln('Impossible');
        exit;
        End;
   k := 1;
   f := length(s1);
   dec(f,c);
   f := f div 2;
   t := max(l,r) + f;
   For i := 1 To l Do
      Write(s[i]);
   For i := 1 To t - l do
      write(s1[i]);
   Write('|');
   For i := l + 2 to length(s) Do
      Write(s[i]);
   For i := t - l + 1 To length(s1) do
     Write(s1[i]);
   Writeln();
End.

uses math;
var a,b,c,x,y,i,j,z,z1,z2:longint;
 s,v:ansistring;
  begin
   readln(S);
   readln(v);

   z1:=pos('|',s);
   z2:=z1;
   z:=z1;
    for i:=1 to z-1 do
     inc(x);
    for i:=z+1 to length(S) do
     inc(y);
     z:=length(v);
     a:=min(x,y);
     b:=max(y,x);
     while (a<>b) or (z>0) do
      begin
       if a<b then inc(A) else inc(b);
       dec(z);
      end;
     z:=z-c;
     a:=a+c;
     if z<0 then write('Impossible') else
     if (a=b) and (z mod 2=1) then Write('Impossible') else
     if (a<>b) and (z>0) then Write('Impossible') else
      begin
       for i:=1 to z1-1 do
       begin
        write(s[i]);
        dec(A);
        end;

        for i:=1 to a do
        begin
         write(v[i]);

         end;
         write('|');
        for i:=z2+1 to length(S) do
        begin
         write(s[i]);
         dec(b);
         end;
         for i:=a+1 to length(v) do
         write(v[i]);
      end;
  end.

program v;
var s,b:string;
k,k1,k2,i,o:integer;
begin
readln(s);
readln(b);
for i:=1 to length(s)do
if s[i]='|' then
k:=i;
k1:=k-1;
k2:=length(s)-k;
o:=(abs(k1-k2));
if (o>length(b))or((length(b)-o) mod 2=1) then
begin
writeln('Impossible');
halt(0);
end else
if k1>k2 then
begin
for i:=1 to (length(b)-o)div 2 do
write(b[i]);
write(s);
for i:=(length(b)-o)div 2+1 to length(b) do
write(b[i]);
end else

begin
for i:=(length(b)-o)div 2+1 to length(b) do
write(b[i]);
write(s);
for i:=1 to (length(b)-o)div 2 do
write(b[i]);
end;
end.

Var s,s1:string;
    a,b,k,i,l,c:Longint;
      begin
        readln(s);
        for i:=1 to length(s) do
          begin
            if s[i]='|' then inc(l);
            if l=0 then inc(a);
            if (l=1)and(s[i]<>'|') then inc(b);
          end;
         readln(s1);
        k:=b-a;
        if abs(k)>length(s1) then begin
                                    writeln('Impossible');
                                    exit;
                                  end;
        if k<0 then begin
                      for i:=1 to abs(k) do
                       begin
                        s:=s+s1[1];
                        delete(s1,1,1);
                       end;
                    end;
        if k>0 then begin
                      for i:=1 to k do
                       begin
                        s:=s1[1]+s;
                        delete(s1,1,1);
                       end;
                    end;
        if length(s1) mod 2=1 then begin writeln('Impossible'); exit; end
                          else begin
                                 for i:=1 to length(s1) div 2 do
                                   begin
                                     s:=s+s1[length(s1)-i+1];
                                     s:=s1[i]+s;
                                   end;
                                 writeln(s);
                               end;
      end.

uses math;
var s1,s2,tmp,l,r:ansistring;
    i,x,lr,ll,l2:longint;
begin
   readln(s1); readln(s2);
   l:='';r:='';
   for i:=1 to length(s1) do if s1[i] = '|' then begin x:=i; break; end;
   for i:=1 to x-1 do l:=l+s1[i];
   for i:=x+1 to length(s1) do r:=r+s1[i];
   ll:=length(l); lr:=length(r); l2:=length(s2);
   if (l2 >= abs(ll-lr)) and ((l2-abs(ll-lr))mod 2=0 )then begin
    tmp:='';
    for i:=l2-abs(ll-lr)+1 to l2 do tmp:=tmp+s2[i];
    if ll > lr then r:=r+tmp else l:=l+tmp;
   // writeln(tmp); writeln(l); writeln(r);
    for i:=1 to (l2 - abs(ll-lr)) div 2 do begin
      l:=l+s2[2*i-1];
      r:=r+s2[2*i]
    end;
  //  writeln(l); writeln(r);
    writeln(l+'|'+r);
    halt;
   end;
   writeln('Impossible');
end.

var s1,s2:string;
	i,j,t,k,r,r1,l,l2:integer;
begin
	readln(s1);
	readln(s2);
	i:=1;
	while s1[i]<>'|' do
		inc(i);
	l:=i-1; r:=length(s1)-i;
	t:=length(s2);
	if odd(t+l+r) then begin write('Impossible'); exit; end;
	if abs(l-r)>t then write('Impossible')
	else begin
		k:=(r+l+t) div 2;
		r1:=k-r;
		l2:=k-l;
		for j:=1 to i-1 do write(s1[j]);
		for j:=1 to l2 do write(s2[j]);
		write(s1[i]);
		for j:=i+1 to length(s1) do write(s1[j]);
		for j:=l2+1 to length(s2) do write(s2[j]);
	end;
end.

var
    s,f,s1 : string;
    i,k,r,f1 : longint;
begin
   // assign(input,'382A.INP'); reset(input);
   // assign(output,'328A.OUt'); rewrite(output);
    readln(s);
    readln(f);

    if (length(s) - 1 + length(f)) mod 2 <> 0 then
        writeln('Impossible')
    else
    begin
         r := length(f);
         for i := 1 to length(f) do
            begin
                k := pos('|',s);
                if k - 1 > length(s) - k then
                begin
                    insert(f[i],s,k + 1);
                    dec(r);
                    k := pos('|',s);
                    if (k - 1 = length(s) - k) and (r = 0) then break;
                end
                else
                if k - 1 < length(s) - k then
                begin
                    k := pos('|',s);
                    insert(f[i],s,k - 1);
                    dec(r);
                    if (k - 1 = length(s) - k) and (r = 0) then break;
                end
                else
                    if (k - 1 = length(s) - k) and (r > 0) then
                    begin
                        insert(f[i],s,k - 1) ;
                        dec(r);
                        if (r = 0) and (k - 1 = length(s) - k) then break;
                    end;
            end;

     k := pos('|',s);
     if k - 1 = length(s) - k then
        writeln(s)
     else
        writeln('Impossible');
    end ;

end.

var
 S1,S:String;
 x,uk,Kol1,Kol2,i,Kol:longint;
 f:Boolean;

begin
 Readln(S1);
 Readln(S);
  i:=1;
  While S1[i]<>'|' do Inc(i);
 Kol1:=i-1;
 Kol2:=length(S1)-i;
 Kol:=length(S);
 // Ans:=S1;
  f:=true;
  uk:=1;
  While f do begin
    if Kol1<=Kol2 then begin
       Inc(kol1);
       S1:=S[uk]+S1;
       Inc(uk);
                       end else begin inc(kol2); S1:=S1+S[uk]; Inc(uk);end;
   if uk>length(S) then f:=false;
             end;
 if (Kol1<>Kol2)or(length(S1) mod 2 = 0) then Write('Impossible') else Write(S1);
end.

{$r-,s-,q-,i-,o+}
var
  s,t:ansistring;
  v1,v2,i:longint;
begin
  readln(s);
  v1:=pos('|',s)-1;
  v2:=length(s)-v1-1;
  readln(t);
  for i:=0 to length(t) do
    if (v1+i=v2+length(t)-i) then
      begin
        writeln(copy(t,1,i),s,copy(t,i+1,length(t)-i));
        halt(0);
      end;
  writeln('Impossible');
end.

var s,c:ansistring;
    k,x,y,n,i,j,z,m,p:longint;
 begin
  //      assign(input,'input.txt'); reset(input);
 //  assign(output,'output.txt'); rewrite(output);
    readln(s);n:=length(s);
    k:=pos('|',s)-1;m:=n-k-1;
    readln(c);z:=length(c);
    if(abs(k-m)>z)or(abs(k-m)mod 2<>z mod 2)then begin
                                                  writeln('Impossible');
                                                  exit;
                                                 end;
    p:=(k+m+z)div 2;
    for i:=1 to p-k do s:=c[i]+s;
    for i:=p-k+1 to z do s:=s+c[i];
    writeln(s);
 end.

var  s,s1,s2:ansistring;
    z,q,l1,l2,i,j,k1,k2,k,pos:longint;
  begin
   readln(s1);
   reADlN(s2);
   l1:=length(s1);
   l2:=length(s2); pos:=-1;
   for i:=1 to l1 do
   begin
   if (s1[i]='|') then pos:=i;
   if (pos=-1) then inc(k1)
   else if (s1[i] in ['A'..'Z'])then inc(k2);
   end;
   if (k1+k2+l2)mod 2=1 then begin
   writeln('Impossible');
   halt(0);
   end;
  q:=(k1+k2+l2)div 2;
  if (k1>q)or(k2>q) then  begin
   writeln('Impossible');
   halt(0);
   end;
   z:=q-k1;
   begin
   for i:=1 to pos-1 do
   s:=s+s1[i];
   while (z>0) do
   begin
     inc(k);
     s:=s+s2[k];
     dec(z);
   end;
   end;
   s:=s+'|';
   z:=q-k2;

     begin
   for i:=pos+1 to l1 do
   s:=s+s1[i];
   while (z>0) do
   begin
     inc(k);
     s:=s+s2[k];
     dec(z);
   end;
   end;
   writeln(s);
  end.

uses math,sysutils;
var //a,b,c:array[1..10000] of longint;
    i,j,k,l,m,h,y,t,x,x1,y1,n:longint;
    s,s1,s2:ansistring;
begin
    readln(s);
    readln(s1);n:=length(s);
    for i:=1 to n do
    begin
        if s[i]='|' then
        begin
            l:=1;
            continue;
        end ;
        if l=0 then
        begin
            inc(x);
            continue;
        end;
        if l=1 then
        begin
            inc(y);
            continue;
        end;
    end;
    t:=length(s1);
    if (max(y,x)>min(y,x)+t) then
    begin
        write('Impossible');
        halt;
    end;
    if (max(x,y)-min(x,y)+t) mod 2=1 then
    begin
        write('Impossible');
        halt;
    end;
    h:=abs(x-y);
    x1:=x+(t-h)div 2;
    y1:=y+(t-h)div 2;
    if x1>y1 then inc(y1,h);
    if x1<y1 then inc(x1,h);

    for i:=1 to x1-x do
        write(s1[i]);
    delete(s1,1,x1-x);
    write(s);
    write(s1);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  i,j,n,m,k,g,f:integer;
  s,s1,s2,t:string;
  a:array[0..1000000] of integer;
begin
  readln(s);
  readln(t);
  s1:=copy(s,1,pos('|',s)-1);
  s2:='';
  for i:=pos('|',s)+1 to length(s) do
    s2:=s2+s[i];
  i:=1;
  while (i<=length(t)) do
  begin
    if (length(s1)<=length(s2)) then
      s1:=s1+t[i]
    else
      s2:=s2+t[i];
    inc(i);
  end;
  if (length(s1)=length(s2)) then
    write(s1,'|',s2)
  else
    write('Impossible');
  readln;
  readln;
end.

program task_one;

var i : longint;
was : boolean;
s : ansistring;
a, b : ansistring;
begin
	Readln(s);
	was:=false;
	a:=''; b:='';
	for i:=1 to length(s) do begin
		if s[i]<>'|' then begin
			if not was then a:=a + s[i]
			else b:=b + s[i];
		end else was:=true;
	end;
	s:='';
	Readln(s);
	for i:=1 to length(s) do begin
		if length(a)<=length(b) then begin
			a:=a + s[i];
		end else begin
			b:=b + s[i];
		end;
	end;
	if length(a)<>length(b) then Writeln('Impossible')
	else Writeln(a,'|',b);
end.

program p1;
var s,t:string;i,k,l,r,d:integer;
begin
readln(s);
readln(t);
for i:=1 to length(s) do
if (s[i]='|') then
begin
k:=i;
break;
end;
r:=length(s)-k;
l:=k-1;
d:=abs(l-r);
if (length(t)<d) or ((length(t)-d)mod 2<>0) then writeln('Impossible')
else
begin
if (l>r) then
begin
for i:=1 to ((length(t)-d) div 2) do write(t[i]);
write(s);
for i:=(((length(t)-d) div 2)+1) to length(t) do write(t[i]);
end
else
begin
for i:=1 to ((length(t)-d)div 2+d) do write(t[i]);
write(s);
for i:=((length(t)-d)div 2+d+1) to length(t) do write(t[i]);
end;
end;
end.

Var

s2,q1,q2: string;
s : char;
i,j,k1,k2,z,t,t2,t3,x,y : integer;

Begin
 z:=1;
 While not eoln do begin
       Read (s);
       If s = '|' then begin
           z:=2;
           continue
       end;
       If z=1 then begin k1:=k1+1; q1:=q1+s; end;
       If z=2 then begin k2:=k2+1; q2:=q2+s; end;
 end;
 Readln;
 Read (s2);
 t := length (s2);

 If k1<k2 then begin
    If k2-k1 > t then begin
       Write ('Impossible');
       Halt;
    end Else begin
             t2:=t-(k2-k1);
             If t2 mod 2 = 1 then begin
                Write ('Impossible');
                Halt;
             end Else begin
                      For i:= 1 to (k2-k1) do begin
                          q1:=q1+s2[i];
                          j:=i;
                      end;
                      If t2 = 0 then begin
                         Writeln (q1,'|',q2);
                         halt;
                      end;
                      t3:=t2 div 2;
                      y:=t3;
                       x:=j+1;
                      While y > 0 do begin
                          q1:=q1+s2[x];
                          inc (x);
                          dec (y);
                      end;
                      y:=t3;
                      While y > 0 do begin
                          q2:=q2+s2[x];
                          inc (x);
                          dec (y);
                      end;
                      Writeln (q1,'|',q2);
                 end;
        end;
 end;

 If k1>k2 then begin
    If k1-k2 > t then begin
       Write ('Impossible');
       Halt;
    end Else begin
             t2:=t-(k1-k2);
             If t2 mod 2 = 1 then begin
                Write ('Impossible');
                Halt;
             end Else begin
                      For i:= 1 to (k1-k2) do begin
                          q2:=q2+s2[i];
                          j:=i+1;
                      end;
                      If t2 = 0 then begin
                         Writeln (q1,'|',q2);
                         halt;
                      end;
                      t3:=t2 div 2;
                      y:=t3;
                       x:=j;
                      While y > 0 do begin
                          q2:=q2+s2[x];
                          inc (x);
                          dec (y);
                      end;
                      y:=t3;
                      While y > 0 do begin
                          q1:=q1+s2[x];
                          inc (x);
                          dec (y);
                      end;
                      Writeln (q1,'|',q2);
                 end;
        end;
 end;

 If k1=k2 then begin

   t2 := t;
   If t2 mod 2 = 1 then begin
                Write ('Impossible');
                Halt;
   end;

                      t3:=t2 div 2;
                      y:=t3;
                      x:=1;
                      While y > 0 do begin
                          q2:=q2+s2[x];
                          inc (x);
                          dec (y);
                      end;
                      y:=t3;
                      While y > 0 do begin
                          q1:=q1+s2[x];
                          inc (x);
                          dec (y);
                      end;
                      Writeln (q1,'|',q2);

 end;
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  t=record
    i,x,cnt:integer;
  end;
var
  a,b,c:array[1..100100]of integer;
  n,i,j,k,l,r,m,x,y,max,min,d:integer;
  cnt,sum,p,kol:int64;
  q,w,e:boolean;
  s,s1:string;

begin
  readln(s);
  readln(s1);
  l:=0;
  r:=0;
  q:=false;
  sum:=length(s)-1+length(s1);
  if(sum mod 2<>0)then
  begin
    writeln('Impossible');
    exit;
  end;
  for i:=1 to length(s) do
  begin
    if not(q)and(s[i]<>'|')then
      inc(l)
    else if(s[i]='|')then
    begin
      q:=true;
      x:=i;
    end
    else if(q)then
      inc(r);
  end;
  if(length(s1)<abs(r-l))or((r=l)and(length(s1) mod 2=1))then
    writeln('Impossible')
  else
  begin
      for i:=1 to x-1 do
        write(s[i]);
      for i:=x to sum div 2 do
        write(s1[i-x+1]);
      y:=i-x;
      write('|');
      for i:=x+1 to length(s) do
        write(s[i]);
      for i:=y+1 to length(s1)do
        write(s1[i]);
  end;
  readln;
  readln;
end.

program yan;
  var s,s1:ansistring;
      i,j,x,y,a,b,n,m:longint;
begin
  readln(s);
  read(s1);
  for i:=1 to length(s) do
    begin
      if s[i]='|' then begin x:=1; continue; end;
      if (x=0) then inc(a) else inc(b);
    end;
  if abs(a-b)>length(s1) then begin write('Impossible'); exit; end;
  if a>b then
    while b<a do
      begin
        inc(j);
        s:=s+s1[j];
        inc(b);
      end
  else
    while a<b do
      begin
        inc(j);
        s:=s1[j]+s;
        inc(a);
      end;
  if (length(s1)-j) mod 2<>0 then begin write('Impossible'); exit; end;
  for i:=j+1 to length(s1) do
    if i mod 2<>0 then s:=s+s1[i] else s:=s1[i]+s;
  write(s);
end.

{$MODE OBJFPC}
program P382A;
const
    fin='';
    fou='';
var
    s,x:ansistring;
    n_L,n_R:longint;
    fi,fo:text;

procedure   enter();
    begin
        assign(fi,fin);reset(fi);
        readln(fi,s);
        readln(fi,x);
        close(fi);
    end;

function    min(x,y:longint):longint;
    begin
        if (x<y) then exit(x)
        else exit(y);
    end;

function    max(x,y:longint):longint;
    begin
        if (x>y) then exit(x)
        else exit(y);
    end;

procedure   solve();
    var
        i,p:longint;
        c:boolean=false;
    begin
        for i:=1 to length(s) do
            if (s[i]='|') then
                begin
                    p:=i;
                    c:=true;
                end
            else
                if (c) then
                    inc(n_R)
                else
                    inc(n_L);
        assign(fo,fou);rewrite(fo);
        if (odd(length(x)+n_R-n_L)) or (length(x)+n_R-n_L<0) or (length(x)+n_L-n_R<0) then
            write(fo,'Impossible')
        else
            begin
                for i:=1 to p-1 do write(fo,s[i]);
                for i:=1 to ((length(x)+n_R-n_L) div 2) do write(fo,x[i]);
                write(fo,'|');
                for i:=p+1 to length(s) do write(fo,s[i]);
                for i:=((length(x)+n_R-n_L) div 2+1) to length(x) do write(fo,x[i]);
            end;
        close(fo);
    end;

begin
    enter();
    solve();
end.

var
  i,j,k,l1,l2,l3,m,n:longint;
  s,s1:ansistring;
begin
  readln(s);
  readln(s1);
  l1:=pos('|',s);
  l2:=length(s)-l1;
  dec(l1);
  l3:=length(s1);
  if(abs(l1-l2)>l3) or((l1+l2+l3)mod 2=1)then
    write('Impossible')
  else write(copy(s,1,l1),copy(s1,1,(l2+l3-l1)div 2),'|',copy(s,l1+2,l2),copy(s1,((l2+l3-l1)div 2)+1,(l1+l3-l2)div 2));

end.

const   fi='';
var
        s,s1:ansistring;

procedure enter;
begin
        assign(input,fi); reset(input);
        readln(s);
        readln(s1);
        close(input);
end;
procedure solve;
var i,w1,w2,n,n1,m:int32; divi:boolean;
begin
        divi:= false;
        w1:= 0; w2:= 0; n:= length(s); n1:= length(s1);
        for i:= 1 to n do
                if s[i]='|' then
                        divi:= true
                else
                if divi then
                        inc(w2)
                else
                        inc(w1);
        m:= (w1+w2+n1) shr 1;
        if ((w1+w2+n1) and 1=1) or( n1+w2<m) or (n1+w1<m) then
                write('Impossible')
        else
        begin
                for i:= 1 to m-w1 do write(s1[i]);
                write(s);
                for i:= m-w1+1 to n1 do write(s1[i]);
        end;
end;
begin
        enter;
        solve;
end.

Var s1,s2:string;
j,i:longint;
begin
   // Assign(input,'input.txt'); reset(input);
   // Assign(output,'output.txt'); rewrite(output);
    readln(s1);
    readln(s2);
    if (length(s1)+length(s2)-1) mod 2=1
    then writeln('Impossible')
    else begin
          j:=(length(s1)+length(s2)-1) div 2;
          if (pos('|',s1)-1>j)or(length(s1)-pos('|',s1)>j)
          then writeln('Impossible')
          else begin
                j:=j-(pos('|',s1)-1);
                for i:=1 to j do
                s1:=s2[i]+s1;
                for i:=j+1 to length(s2) do
                s1:=s1+s2[i];
                writeln(s1);
               end;
         end;
end.

var s1,s2:string;
    i,l:byte;

BEGIN
readln(s1);readln(s2);
i:=1;
while s1[i]<>'|' do i:=i+1;
l:=length(S1);
while ((length(s1)-i<>i-1) or (length(s2)>1))and(length(s2)>0) do
        begin
        if length(s1)-i=i-1 then
                begin
                s1:=s2[1]+s1+s2[2];
                delete(s2,1,2);
                i:=i+1;
                end
        else if length(s1)-i<i-1 then
                begin
                s1:=s1+s2[1];
                delete(s2,1,1);
                end
        else if length(s1)-i>i-1 then
                begin
                s1:=s2[1]+s1;
                delete(s2,1,1);
                i:=i+1;
                end;
        end;
if odd(length(s1)) and (i=length(s1) div 2+1) and (l<>length(s1)) and (length(s2)=0) then write(s1) else write('Impossible');
END.

           {$APPTYPE CONSOLE}

                               const  besk=2000000000;  eps=1e-10;
 label 1,2,3,4;
 var  i1,i2,i3,i4,nap,kk,j2,mask1,mask2,k,i,shag,nn,n1,ii,jj,j1,sdvig,ppp,mask,i0,j0,step,j,isp,finish:longint;
ogr1,ogr,iii,rrold,x,sum,pos,kol,p0,ot,ll,rr,cc,zapros,plot,vot,bb,kolich,x0,v0,v,xmax,vmax, pnew,l,r,k1,p3,d,poz,pp,n,w,h,p,q,a1,a2,b1,b2,t,m1,pl,p1,p2,m,k2,x1,y1,d1,d2,t1,t2,modul,tt,ot1,ot2,s,kold,kkr:int64;
aeqb,agrb,bgra,koef:int64;
fl0,fl10,fl100,flag2,flag1,flag:boolean;
ott,pp1,pp2,dl1,dl2,dl3,hh,po,pt,doltek,dolpred:extended;
dist:array[-10..310,-10..310] of int64;
ddd,distot:double;
dd: array[-100..79,-100..75] of char;
aa,pos1,pos6,pos8,pos9,b,a,llold,newoch,och,str,c,z,y: array[-1000000..5000002] of int64;
bad,marked,est,zapx,zapy:array[-10..200000] of boolean;
gr: array[-2..30,-2..300000] of int64;
zan,dlin,koled:array[-1000..160000] of boolean;
ss:array[0..2000] of string;
sss1,sss,sss2:string;
aa1,aanew:array[-100..200,-100..201] of int64;
ch11,ch12,ch1,ch:char;
sl,sr :array[-10 ..200000] of int64;
ssot:array[-1000..1100000] of char;
stepen:array[0..1000] of int64;
name:array[0..2000] of string;
function min (a,b:int64):int64;begin min:=b;if a<b then min:=a;  end;
function max (a,b:int64):int64;begin max:=b;if a>b then max:=a;  end;

    function nod(a,b:int64):int64; var p,t:int64;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

function degg(a,k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else
   begin  p:=degg(a,k div 2); degg:=p*p mod modul;   end;

end;

begin
  { reset(input,'input.txt');close(input);
    rewrite(output,'output.txt');close(output);
   }
 readln(sss1);
 readln(sss2);
n:=length(sss1); n1:=length(sss2);
for i:=1 to n do if sss1[i]='|' then k:=i;
if  not odd(n+n1) then begin   write('Impossible'); goto 1 ;     end;
if  n1+k-1<n-k then begin   write('Impossible'); goto 1 ;     end;
if  n1+n-k<k-1 then begin   write('Impossible'); goto 1 ;     end;
t:=(n1+n) div 2;
p:=t-k+1;
{writeln(t,'  ==  ',p); }
for i:=1 to k-1 do write(sss1[i]);
for i:=1 to p do write(sss2[i]);
for i:=k to n do write(sss1[i]);
for i:=p+1 to n1 do write(sss2[i]);

   1:          close(output);

end.

  var s,s1:ansistring;
      i,k1,k2,k3:longint;
      u:byte;

begin s:='';
   readln(s);
   u:=0; s1:=''; k1:=0;k2:=0;
    for i:=1 to length(s) do
      begin
       if s[i]='|' then u:=1;
       if s[i] in ['A'..'Z'] then if u=0 then inc(k1)
                                         else inc(k2);
      end;
     readln(s1); k3:=length(s1);
              i:=1;
     if ((k3+k2+k1) mod 2 = 1) or (k1>k2+k3) or (k2>k3+k1) then writeln('Impossible')
                             else begin
                                   while k3<>0 do
                                    begin
                                     if k1>k2 then begin s:=s+s1[i]; inc(i);inc(k2); dec(k3); end
                                              else begin write(s1[i]); inc(k1); inc(i); dec(k3); end;
                                    end;
                                    write(s);
                                  end;

  readln;
{Totusi este trist in lume}
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, math;

var
  a: array[1..1000000] of integer;
  i, j, n, m, k, l, r, q, c: integer;
  s, t: string;
begin
  readln(s);
  readln(t);
  n := length(s);
  m := length(t);
  k := pos('|',s);
  l := k-1;
  r := n - k;
  q := max(l, r) - min(l, r);

  if (odd(m-q)) or (q >m) then
  begin
    writeln('Impossible');
    exit;
  end;
  c := (m-q) div 2;
  if (l < r) then
  begin
    write(copy(t,1,q+c));
    write(s);
    write(copy(t,q+c+1, m));
    readln;
    exit;
  end;
  write(copy(t,1,c));
  write(s);
  write(copy(t,c+1, m));
  readln;
  readln;
end.

program z12;
var     s1,s2,cop:string;
        ch:char;
        dl1,dl2,dl3,i:integer;
begin
s1:='';s2:='';
read(ch);
while ch<>'|' do
        begin
        s1:=s1+ch;
        read(ch);
        end;
while not eoln do
        begin
        read(ch);
        s2:=s2+ch;
        end;
readln;
readln(cop);
dl1:=length(s1);
dl2:=length(s2);
dl3:=length(cop);
if (abs(dl1-dl2)<=dl3) and ((dl1+dl2+dl3) mod 2=0) then
        begin
        while length(s1)<>(dl1+dl2+dl3) div 2 do
                begin
                inc(i);
                s1:=s1+cop[i];
                end;
        while length(s2)<>(dl1+dl2+dl3) div 2 do
                begin
                inc(i);
                s2:=s2+cop[i];
                end;
        writeln(s1,'|',s2);
        end
else
        writeln('Impossible');
end.

var
 s,s1:ansistring;
 k,x,y:longint;
begin
 readln(s);
 readln(s1);
 k:=pos('|',s);
 x:=length(copy(s,1,k-1));
 y:=length(copy(s,k+1,length(s)));
 if abs(x-y)<>length(s1) then
  begin
   writeln('Impossible');
   halt;
  end;
 if x<y then writeln(s1+s)
            else writeln(s+s1);
end.

var s1,s2:ansistring;
function check(s:ansistring):boolean;
var i,len:longint;
begin
   len:=0;
   for i:=1 to length(s) do
   if s[i] <> '|' then inc(len) else break;
   if length(s) - len - 1 = len then exit(true);
   exit(false);
end;
begin
   readln(s1); readln(s2);
   if check(s1+s2) = true then writeln(s1+s2) else
   if check(s2+s1) = true then writeln(s2+s1) else
   writeln('Impossible');
end.

var  t,n,i:integer;a,b,t1,t2:string;
begin readln(a);readln(b);n:=length(a);
t:=pos('|',a);

if (length(a)-1+length(b)) mod 2=1 then begin write('Impossible');halt;end;
t2:=copy(a,t+1,n);
t1:=copy(a,1,t-1);
for i:=1 to length(b) do
if length(t1)<length(t2) then t1:=b[i]+t1 else t2:=t2+b[i];
write(t1,'|',t2);

end.

var s1,s2, i,j: LongInt;
x, ans: String;
res: Boolean;
begin
  Readln(x);
  Readln(ans);

  res:=false;

  for i:=1 to length(x) do
  begin
    if x[i]='|' then
    begin
      res:=true;
      continue;
    end;
    if res then inc(s2) else inc(s1);
  end;

  Writeln(s1,' ',s2);
  if (length(ans) >= abs(s1-s2)) and ((length(ans) - abs(s1-s2)) mod 2 = 0) then
  begin
    if s1>s2 then
    begin
      for i:=1 to (s1-s2) do
      begin
        x:=x + ans[i];
      end;
      Delete(ans,1,(s1-s2));

      for i:=1 to length(ans) do
      if odd(i) then x:=ans[i] + x else x:=x + ans[i];

      Writeln(x);
    end else
    if s2>s1 then
    begin
        for i:=1 to (s2-s1) do
        begin
          x:=ans[i] + x;
        end;
        Delete(ans,1,(s2-s1));

      for i:=1 to length(ans) do
      if odd(i) then x:=ans[i] + x else x:=x + ans[i];

      Writeln(x);
    end else
    begin
      for i:=1 to length(ans) do
      if odd(i) then x:=ans[i] + x else x:=x + ans[i];
    end;
  end else Writeln('Impossible');
end.

var s, t : string;
    L, R, i : longint;
begin
     readln(s);
     L := length(copy(s,1,pos('|',s)-1));
     R := length(s)-L-1;
     readln(t);
     If L = R then
     begin
        If odd(length(t)) then writeln('Impossible')
        else
        begin
           write(copy(s,1,L));
           write(copy(t,1,length(t) div 2));
           write('|');
           write(copy(s,L+2,R));
           writeln;
        end;
     end;
     If L < R then
     begin
        If (length(t) < R-L) or odd(length(t)-R+L) then writeln('Impossible')
        else
        begin
           write(copy(s,1,L));
           write(copy(t,1,R-L));
           write(copy(t,R-L+1,(length(t)-R+L) div 2));
           write('|');
           write(copy(s,L+2,R));
           write(copy(t,R-L+(length(t)-R+L) div 2+1,(length(t)-R+L) div 2));
           writeln;
        end;
     end;
     If R < L then
     begin
        If (length(t) < L-R) or odd(length(t)-L+R) then writeln('Impossible')
        else
        begin
           write(copy(s,1,L));
           write(copy(t,1,(length(t)-L+R) div 2));
           write('|');
           write(copy(s,L+2,R));
           write(copy(t,(length(t)-L+R) div 2+1,L-R));
           write(copy(t,(length(t)-L+R) div 2+L-R+1,(length(t)-L+R) div 2));
           writeln;
        end;
     end;
end.

program scalse;
var
    s,t,res:string;
    lens,lent,i,j,k,left,right,pos:integer;
begin
     readln(s);
     readln(t);
     lens:=length(s);
     lent:=length(t);
     for i:=1 to lens do
       begin
        if(s[i]='|')then
            begin
                pos:=i;
                break;
            end
        else
            if((s[i]='')or(s[i]=' '))then  continue
            else
                inc(left);
       end;
     for i:=pos+1 to lens do
       begin
             if((s[i]='')or(s[i]=' '))then  continue
            else
                inc(right);
      end;
     if(left+lent=right)then insert(t,s,left+1)
     else  if(left=right+lent) then insert(t,s,lens+1)
     else s:='Impossible';
      writeln(s);
end.

var
i,j,c,d,e,b,n:longint;
s,s1,s2,s3:string;
begin
readln(s);
readln(s1);
j:=pos('|',s);
c:=j-1;
s2:=copy(s,1,j-1);
d:=length(s)-j;
s3:=copy(s,j+1,length(s));
if c+length(s1)=d then begin writeln(s1+s2,'|',s3);exit;end;
if d+length(s1)=c then begin writeln(s2,'|',s3+s1);exit;end;
writeln('Impossible');
end.

var s,f,s2,s1:string;
x:longint;
begin
readln(s);
readln(f);
x:=pos('|',s);
s1:=copy(s,1,x-1);
s2:=copy(s,x+1,length(s)-x+1);
while length(f)<>0 do begin
                      if length(s1)<length(s2) then s1:=s1+f[1] else s2:=s2+f[2];
                      delete(f,1,1);
                      end;
if length(s1)=length(s2) then write(s1,'|',s2) else write('Impossible');
end.

  var s,s1:ansistring;
      i,k1,k2:longint;
      u:byte;

begin s:='';
   readln(s);
   u:=0; s1:=''; k1:=0;k2:=0;
    for i:=1 to length(s) do
      begin
       if s[i]='|' then u:=1;
       if s[i] in ['A'..'Z'] then if u=0 then inc(k1)
                                         else inc(k2);
      end;
     readln(s1);

     if k1>k2 then  if k2+length(s1)=k1 then writeln(s,s1)
                                        else writeln('Impossible')
              else if k1+length(s1)=k2 then writeln(s1,s)
                                       else writeln('Impossible');

  readln;
{Totusi este trist in lume}
end.

Program azkaban;
var s,s1,s2,s3 : string;
    k,i,dif : longint;
begin readln(S);
    i:=1;
    while s[i]<>'|' do begin k:=k+1; i:=i+1; end;
    s1:=copy(s,1,k);
    s2:=copy(s,k+2,length(S)-k-1);
    readln(s3);
    dif:=length(s1)-length(s2);
    if length(S3)<dif then write('Impossible')
                      else
    if (length(s3)>0) and (dif=0) then write('Impossible')
                      else begin
    if dif>0 then begin
                                      write(s1,'|');
                                      for i:=1 to dif do write(s2,s3[i]);
                                end
             else if dif<0 then begin
                                      for i:=1 to abs(dif) do write(s3[i]);
                                      write(s1);
                                                         write('|',s2); end;
             end;
end.

program project1;

var
  vesy: string;
  other: string;
  symNum: integer;
  leftSymNum: integer;

begin
  readln(vesy);
  symNum:=Pos('|',vesy);
  readln(other);
  if((Length(vesy)-1+Length(other)) mod 2=1) then
    writeln('Impossible')
  else
  begin
    leftSymNum:=symNum-1-(Length(vesy)-symNum);
    if(abs(leftSymNum)>Length(other)) then
       writeln('Impossible')
    else
    begin
      insert(Copy(other, 1, (Length(other)-leftSymNum) shr 1), vesy, symNum);
      insert(Copy(other, ((Length(other)-leftSymNum) shr 1), Length(other)), vesy, Length(vesy)+1);
      writeln(vesy);
    end;
  end;
end.

var s1,s2:string;
    i:byte;

BEGIN
readln(s1);readln(s2);
i:=1;
while s1[i]<>'|' do i:=i+1;
//if length(s1)-i=i-1 then begin write('Impossible');halt;end;
while ((length(s1)-i<>i-1) or (length(s2)>1))and(length(s2)>0) do
        begin
        if length(s1)-i=i-1 then
                begin
                s1:=s2[1]+s1+s2[2];
                delete(s2,1,2);
                i:=i+1;
                end
        else if length(s1)-i<i-1 then
                begin
                s1:=s1+s2[1];
                delete(s2,1,1);
                end
        else if length(s1)-i>i-1 then
                begin
                s1:=s2[1]+s1;
                delete(s2,1,1);
                i:=i+1;
                end;
        end;
if odd(length(s1)) and (i=length(s1) div 2+1) then write(s1) else write('Impossible');
END.

program project1;

{$mode objfpc}{$H+}
var
  vesy: string;
  other: string;
  symNum: integer;
  leftSymNum: integer;

begin
  readln(vesy);
  symNum:=Pos('|',vesy);
  readln(other);
  if((Length(vesy)-1+Length(other)) mod 2=1) then
    write('Impossible')
  else
  begin
    leftSymNum:=symNum-1-(Length(vesy)-symNum);
    if(abs(leftSymNum)>Length(other)) then
       write('Impossible')
    else
    begin
      insert(Copy(other, 1, (Length(other)-leftSymNum) shr 1), vesy, symNum);
      insert(Copy(other, ((Length(other)-leftSymNum) shr 1), Length(other)), vesy, Length(vesy)+1);
      write(vesy);
    end;
  end;
end.

var s1,s2:string;
    ch1,ch2:string;
    i,f:integer;
begin
readln(s1);
readln(s2);
f:=0;
for i:=1 to pos('|',s1)-1 do ch1:=ch1+s1[i];
for i:=1+pos('|',s1) to length(s1) do ch2:=ch2+s1[i];
//if (length(ch1)=length(ch2)) and (length(s2) mod 2<>0) then begin write('Impossible'); halt; end;
while (length(ch1)<>length(ch2)) and (s2<>'') do
 begin
 if (length(ch1)<length(ch2)) and (s2<>'') then
 begin
 ch1:=ch1+s2[1];
 delete(s2,1,1);
 f:=1;
 end;
 if (length(ch1)>length(ch2)) and (s2<>'') then
 begin
 ch2:=ch2+s2[1];
 delete(s2,1,1);
 f:=1;
 end;
 end;
if (f=1) and (length(ch1)=length(ch2)) then write(ch1,'|',ch2)
       else write('Impossible');
end.

program form;
var s, ss: string;
n,m,i,j,k: longint;

begin
//assign (input, 'input.txt');reset (input);
//assign (output, 'output.txt'); rewrite (output);
readln (s);
for i:= 1 to length (s) do
if s[i] = '|' then break;
readln (ss);

if (length (s) + length (ss)) mod 2 =0 then
begin writeln ('Impossible'); halt; end;

m:=  (length (s) + length (ss)) div 2;
if (i-1<= m) and (length (s)-i <=m)
then
else begin writeln ('Impossible'); halt; end;
j:= 1;
for k:= 1 to m do
begin
if (k<i) then write (s[k]);
if k>i then begin write (ss[j]); inc (j); end;
end;
write (s[i]);
for k:= i+1 to length (s) do
write (s[k]);
for k:= j to length (ss) do
write (ss[k]);

//close (input); close (output);
end.

program p1;
var s,t:string;i,k,l,r,d:integer;
begin
readln(s);
readln(t);
for i:=1 to length(s) do
if (s[i]='|') then
begin
k:=i;
break;
end;
r:=length(s)-k;
l:=k-1;
d:=abs(l-r);
if (length(t)<d) or ((length(t)-d)mod 2<>0) then writeln('Impossible')
else
begin
if (l>r) then
begin
for i:=1 to ((length(t)-d) div 2) do write(t[i]);
write(s);
for i:=(((length(t)-d) div 2)+1) to length(t) do write(t[i]);
end
else
begin
for i:=1 to ((length(t)-d)div 2+d) do write(t[i]);
write(s);
for i:=((length(t)-d)div 2+d) to length(t) do write(t[i]);
end;
end;
end.

program scalse;
var
    s,t:string;
    lens,lent,i,left,right,pos:longint;
begin
     readln(s);
     readln(t);
     lens:=length(s);
     lent:=length(t);
     for i:=1 to lens do
       begin
        if(s[i]='|')then
            begin
                pos:=i;
                break;
            end
        else
            if(s[i]<>'')then inc(left);
       end;
     right:=lens-pos;
     if(left+lent=right)then insert(t,s,left+1)
     else
        begin
            if(right+lent=left)then insert(t,s,lens+1)
            else
                S:='Impossible';
        end;
     writeln(s);
end.

var i,t1,t2,q,r :longint;
   s1,s2,ss1,ss2,ss:string;
   ok:boolean;
  begin
    readln(s1);
    readln(s2);
    ok:=false;
    for i:=1 to length(s1) do
     begin
      if (s1[i]='|') then begin ok:=true; continue; end;
      if ok then begin inc(t2); ss2:=ss2+s1[i] end
      else begin inc(t1); ss1:=ss1+s1[i];end;
     end;

    if t1<t2 then begin
                     q:=t2-t1;
                     if q>length(s2) then begin writeln('Impossible'); halt; end;
                     for i:=1 to q do
                      ss1:=ss1+s2[i];
                     if (length(s2)-q) mod 2=0 then begin
                                                      r:=(length(s2)-q) div 2;
                                                      if r<>0 then begin
                                                      for i:=q+1 to q+r do
                                                       ss1:=ss1+s2[i];
                                                       for i:=r+1 to length(s2) do
                                                        ss2:=ss2+s2[i];
                                                        end;
                                                      ss:=ss1+'|'+ss2;
                                                      writeln(ss);
                                                      halt;
                                                    end
                                                    else begin writeln('Impossible'); halt; end;
                  end
     else begin
     q:=t1-t2;
            if q>length(s2) then begin writeln('Impossible'); halt; end;
                     for i:=1 to q do
                      ss2:=ss2+s2[i];
                     if (length(s2)-q) mod 2=0 then begin
                                                      r:=(length(s2)-q) div 2;
                                                      if r<>0 then begin
                                                      for i:=q+1 to q+r do
                                                       ss2:=ss2+s2[i];
                                                       for i:=q+r+1 to length(s2) do
                                                        ss1:=ss1+s2[i];
                                                        end;
                                                      ss:=ss1+'|'+ss2;
                                                      writeln(ss);
                                                      halt;
                                                    end
                                                    else begin writeln('Impossible'); halt; end;
          end;
  end.

uses math,sysutils;
var //a,b,c:array[1..10000] of longint;
    i,j,k,l,m,h,y,t,x,x1,y1,n:longint;
    s,s1,s2:ansistring;
begin
    readln(s);
    readln(s1);n:=length(s);
    for i:=1 to n do
    begin
        if s[i]='|' then
        begin
            l:=1;
            continue;
        end ;
        if l=0 then
        begin
            inc(x);
            continue;
        end;
        if l=1 then
        begin
            inc(y);
            continue;
        end;
    end;
    t:=length(s1);
    if (max(y,x)>min(y,x)+t) then
    begin
        write('Impossible');
        halt;
    end;
    if (max(x,y)-min(x,y)+t) mod 2=1 then
    begin
        write('Impossimle');
        halt;
    end;
    h:=abs(x-y);
    x1:=x+(t-h)div 2;
    y1:=y+(t-h)div 2;
    if x1>y1 then inc(y1,h);
    if x1<y1 then inc(x1,h);

    for i:=1 to x1-x do
        write(s1[i]);
    delete(s1,1,x1-x);
    write(s);
    write(s1);
end.

var a,b:ansistring;
    i,l,r,num:longint;
begin
readln(a);
readln(b);
l:=0;
while (a[l+1]<>'|') do inc(l);
r:=length(a)-l-1;num:=length(a)-1+length(b);
if ((num mod 2=1)or (r-l>length(b))) then begin write('Impossible');halt;end;
for i:=((length(b)+r-l)div 2) downto 1 do a:=b[i]+a;
for i:=((length(b)+r-l)div 2) +1 to length(b) do a:=a+b[i];
writeln(a);
end.

var s,p:string; a,b,c:byte;
begin
    readln(s); readln(p);
    a:=pos('|',s)-1; b:=length(s)-pos('|',s); c:=length(p);
    if (c+a=b) then writeln(p,s) else
    if (a=b+c) then writeln(s,p) else
    if (a+b=c) then writeln(copy(p,1,b),s,copy(p,b+1,a)) else
    if ((a=b) and (c mod 2=0)) then
    writeln(copy(p,1,c div 2),s,copy(p,c div 2+1,c div 2))  else
    if ((a+b+c) mod 2=0) then
    writeln(copy(p,1,(a+b+c) div 2-a),s,copy(p,(a+b+c) div 2-a+1,(a+b+c) div 2-b))
    else writeln('Impossible');
end.

  var s,s1:ansistring;
      i,k1,k2:longint;
      u:byte;

begin
   readln(s);
   u:=0; s:='';s1:=''; k1:=0;k2:=0;
    for i:=1 to length(s) do
      begin
       if s[i]='|' then u:=1;
       if s[i] in ['A'..'Z'] then if u=0 then inc(k1)
                                         else inc(k2);
      end;
     readln(s1);

     if k1>k2 then  if k2+length(s1)=k1 then writeln(s,s1)
                                        else writeln('Impossible')
              else if k1+length(s1)=k2 then writeln(s1,s)
                                       else writeln('Impossible');

  readln;
{Totusi este trist in lume}
end.

var s,p:string; a,b,c:byte;
begin
    readln(s); readln(p);
    a:=pos('|',s)-1; b:=length(s)-pos('|',s); c:=length(p);
    if (c+a=b) then writeln(p,s) else
    if (a=b+c) then writeln(s,p) else
    if (a+b=c) then writeln(copy(p,1,b),s,copy(p,b+1,a)) else writeln('Impossible');
end.

var
 s,s1:ansistring;
 k,x,y:longint;
begin
 readln(s);
 readln(s1);
 k:=pos('|',s);
 x:=length(copy(s,1,k-1));
 y:=length(copy(s,k+1,length(s)));
 if abs(x-y)<>length(s1) then
  begin
   writeln('Impossible');
   halt;
  end;
 if x<y then writeln(s1+s)
            else writeln(s+s1);
end.

  var s,s1:ansistring;
      i,k1,k2,k3:longint;
      u:byte;

begin s:='';
   readln(s);
   u:=0; s1:=''; k1:=0;k2:=0;
    for i:=1 to length(s) do
      begin
       if s[i]='|' then u:=1;
       if s[i] in ['A'..'Z'] then if u=0 then inc(k1)
                                         else inc(k2);
      end;
     readln(s1); k3:=length(s1);
              i:=1;
     if ((k3+k2+k1) mod 2 = 1) or (k1>k2+k3) or (k2>k3+k1) then writeln('Impossible')
                             else begin
                                   while k3<>0 do
                                    begin
                                     if k1>k2 then begin s:=s+s1[i]; inc(i); dec(k3); end
                                              else begin write(s1[i]); inc(i); dec(k3); end;
                                    end;
                                    write(s);
                                  end;

  readln;
{Totusi este trist in lume}
end.

program p1;
var s,t:string;i,k,l,r,d:integer;
begin
readln(s);
readln(t);
for i:=1 to length(s) do
if (s[i]='|') then
begin
k:=i;
break;
end;
r:=length(s)-k;
l:=k-1;
d:=abs(l-r);
if (length(t)<d) or ((length(t)-d)mod 2<>0) then writeln('Impossible')
else
begin
if (l>r) then
begin
for i:=1 to ((length(t)-d) div 2) do write(t[i]);
write(s);
for i:=(((length(t)-d) div 2)+1) to length(t) do write(t[i]);
end
else
begin
for i:=1 to (length(t)div 2+d) do write(t[i]);
writeln(s);
for i:=(length(t)div 2+d+1) to length(t) do write(t[i]);
end;
end;
end.

program p1;
var s,t:string;i,k,l,r,d:integer;
begin
readln(s);
readln(t);
for i:=1 to length(s) do
if (s[i]='|') then
begin
k:=i;
break;
end;
r:=length(s)-k;
l:=k-1;
d:=abs(l-r);
if (length(t)<d) or ((length(t)-d)mod 2<>0) then writeln('Impossible')
else
begin
if (l>r) then
begin
for i:=1 to ((length(t)-d) div 2) do write(t[i]);
write(s);
for i:=(((length(t)-d) div 2)+1) to length(t) do write(t[i]);
end
else
begin
for i:=1 to ((length(t)-d)div 2+d) do write(t[i]);
write(s);
for i:=(length(t)div 2+d) to length(t) do write(t[i]);
end;
end;
end.

program scalse;
var
    s,t,res:string;
    lens,lent,i,j,k,left,right,pos:integer;
begin
     readln(s);
     readln(t);
     lens:=length(s);
     lent:=length(t);
     for i:=1 to lens do
       begin
        if(s[i]='|')then
            begin
                pos:=i;
                break;
            end
        else
            if((s[i]='')or(s[i]=' '))then  continue
            else
                inc(left);
       end;
     for i:=pos+1 to lens do
       begin
             if((s[i]='')or(s[i]=' '))then  continue
            else
                inc(left);
      end;
     if(left+lent=right)then
        begin
            for i:=1 to  left do
              begin
                if((s[i]='')or(s[i]=' '))then continue
                else
                    res:=res+s[i];
              end;
            for j:=1 to lent do
                res:=res+t[j];
            for k:=pos to lens do
                res:=res+s[k];
        end
     else  if(left=right+lent) then
        begin
            for i:=1 to lens do
                res:=res+s[i];
            for j:=1 to lent do
                res:=res+t[j];
         end
     else res:='Impossible';
      writeln(res);
end.

program project1;

var
  vesy: string;
  other: string;
  symNum: integer;
  leftSymNum: integer;

begin
  readln(vesy);
  symNum:=Pos('|',vesy);
  readln(other);
  if((Length(vesy)-1+Length(other)) mod 2=1) then
    writeln('Impossible')
  else
  begin
    leftSymNum:=symNum-1-(Length(vesy)-symNum);
    if(abs(leftSymNum)>Length(other)) then
       writeln('Impossible')
    else
    begin
      insert(Copy(other, 1, (Length(other)-leftSymNum) shr 1), vesy, symNum);
      insert(Copy(other, ((Length(other)-leftSymNum) shr 1), Length(other)), vesy, Length(vesy)+1);
      writeln(vesy);
    end;
  end;
end.

program v;
var s,b:string;
k,k1,k2,i,o:integer;
begin
readln(s);
readln(b);
for i:=1 to length(s)do
if s[i]='|' then
k:=i;
k1:=k-1;
k2:=length(s)-k;
o:=(abs(k1-k2));
if (o>length(b))or((length(b)-o) mod 2=1) then
begin
writeln('Impossible');
halt(0);
end else
if k1>k2 then
begin
for i:=1 to (length(b)-o)mod 2 do
write(b[i]);
write(s);
for i:=(length(b)-o)mod 2+1 to length(b) do
write(b[i]);
end else
begin
for i:=(length(b)-o)mod 2+1 to length(b) do
write(b[i]);
write(s);
for i:=1 to (length(b)-o)mod 2 do
write(b[i]);
end;
end.

program p1;
var s,t:string;i,k,l,r,d:integer;
begin
readln(s);
readln(t);
for i:=1 to length(s) do
if (s[i]='|') then
begin
k:=i;
break;
end;
r:=length(s)-k;
l:=k-1;
d:=abs(l-r);
if (length(t)<d) or ((length(t)-d)mod 2<>0) then writeln('Impossible')
else
begin
if (l>r) then
begin
for i:=1 to ((length(t)-d) div 2) do write(t[i]);
write(s);
for i:=(((length(t)-d) div 2)+1) to length(t) do write(t[i]);
end
else
begin
for i:=1 to (length(t)div 2+d-1) do write(t[i]);
write(s);
for i:=(length(t)div 2+d) to length(t) do write(t[i]);
end;
end;
end.

Program azkaban;
var s,s1,s2,s3 : string;
    k,i,dif,nr : longint;
begin readln(S);
    i:=1;
    while s[i]<>'|' do begin k:=k+1; i:=i+1; end;
    s1:=copy(s,1,k);
    s2:=copy(s,k+2,length(S)-k-1);
    readln(s3);
    dif:=length(s1)-length(s2);
    if (length(S3)+length(s1)+length(s2)) mod 2 <>0 then write('Impossible')
                                          else begin
    i:=1;
    nr:=length(s3);
    while nr <>0 do begin
                            if dif>=0 then begin
                                               s2:=s2+S3[i];
                                               i:=i+1;
                                               nr:=nr-1;
                                               dif:=length(s1)-length(S2);
                                           end
                                      else
                            if dif<0 then begin
                                               s1:=s1+S3[i];
                                               i:=i+1;
                                               nr:=nr-1;
                                               dif:=length(s1)-length(s2);
                                           end;
                             end;
    write(s1,'|',s2);

                     end;

end.

program a123;
var     i,j,k,s1,s2:longint;  n:byte;
      s:array[1..2] of  longint;
      a:array[0..10000] of char;
      x:array[1..10000] of char;
procedure inputdata;
  begin

    i:=0;
    while not eoln do
      begin
        inc(I);
        read(x[i]);

        if x[i] <> '|' then inc(s[n]) else  inc(n);
      end;
    readln(a[0]);
    i:=1;
    while not eoln do
      begin
       read(a[i]);

       inc(I);
      end;
    dec(I);
    k:=i;
    s1:=s[1];
    s2:=s[2];

  end;
procedure outputdata;
  begin

    if (k = 0) and (x[1] = '|')then write('|');
    if k = 0 then if s[1] = s[2] then for j:= 1 to s[1]+s[2]+1 do write(x[j]);
      if abs(s[1]-s[2])= k
          then begin
                 if s[1]>s[2] then begin
                                     for i:= 1 to s[1]+s[2]+1 do
                                           write(x[i]);
                                     i:=1;
                                     while s[1] <> s[2] do
                                       begin
                                         write(a[i]);
                                         inc(s[2]);
                                         inc(I);
                                       end;
                                   end;
                 if s[2] > s[1] then begin
                                       i:=1;
                                       while s[1]<>s[2] do
                                         begin
                                           write(a[i]);
                                           inc(s[1]);
                                           inc(i);
                                         end;
                                       for i:= 1 to s[1]+s[2]+1 do
                                         write(x[i]);
                                     end;
               end
      else if s[1]=s[2] then if i mod 2 <> 0 then begin write('Impossible'); exit; end
                        else if s[1]=s[2] then begin
                            for j:= 1 to  trunc(i div 2) do
                               write(a[j]);
                             for j:= 1 to s[1]+s[2]+1 do
                               write(x[j]);
                             for j:= trunc(i div 2)+1 to i do
                               write(a[j]);exit; end;
    if abs( s1-s2) <> k
                                               then write('Impossible');

  end;
begin
  n:=1;
  s[1]:=0;
  s[2]:=0;
  inputdata;

  outputdata;
end.

var t:char;
    left,right,none:string;
begin
    left:='';
    right:='';
    while not(seekeoln) do
    begin
        read(t);
        if t<>'|' then right:=right+t
        else begin left:=right; right:=''; end;
    end;
    readln;
    readln(none);
    if (length(none)+length(right)<>length(left))and(length(none)+length(left)<>length(right)) then writeln('Impossible')
    else
    begin
        if length(none)+length(left)=length(right) then writeln(none,left,'|',right)
        else writeln(left,'|',none,right);
    end;
end.

var
t,x,y,s:ansistring;
j,k:longint;
begin
readln(x);
readln(y);
j:=pos('|',x);
s:=copy(x,1,j-1);
delete(x,1,j);

if length(x)>length(s) then begin t:=x;x:=s;s:=t;end;
if length(x)+length(y)<length(s) then begin writeln('Impossible');halt;end;
k:=length(x)+length(y)+length(s);
if (k and 1=1)then begin writeln('Impossible');halt;end;
k:=k div 2;
k:=k-length(x);
x:=x+copy(y,1,k);
delete(y,1,k);
s:=s+y;
writeln(s,'|',x);

end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  t=record
    i,x,cnt:integer;
  end;
var
  a,b,c:array[1..100100]of integer;
  n,i,j,k,l,r,m,x,y,max,min,d:integer;
  cnt,sum,p,kol:int64;
  q,w,e:boolean;
  s,s1:string;

begin
  readln(s);
  readln(s1);
  l:=0;
  r:=0;
  q:=false;
  sum:=length(s)-1+length(s1);
  if(sum mod 2<>0)then
  begin
    writeln('Impossible');
    exit;
  end;
  for i:=1 to length(s) do
  begin
    if not(q)and(s[i]<>'|')then
      inc(l)
    else if(s[i]='|')then
    begin
      q:=true;
      x:=i;
    end
    else if(q)then
      inc(r);
  end;
  if(length(s1)<abs(r-l))or(r=l)then
    writeln('Impossible')
  else
  begin
      for i:=1 to x-1 do
        write(s[i]);
      for i:=x to sum div 2 do
        write(s1[i-x+1]);
      y:=i-x;
      write('|');
      for i:=x+1 to length(s) do
        write(s[i]);
      for i:=y+1 to length(s1)do
        write(s1[i]);
  end;
  readln;
  readln;
end.

VAR a,b,c,d:integer;t,t1,t2,n:string[255];
begin
readln(t);
b:=pos('|',t);
t1:=copy(t,1,b-1);
t2:=copy(t,b+1,length(t)-b);
readln(n);
c:=length(n);
d:=length(t1)-length(t2);
if ((d-c) mod 2<>0) or (abs(d)>c) then writeln('impossible') else
begin
write(t1,copy(n,1,(c-d) div 2),'|',t2,copy(n,(c-d) div 2+1,c));
writeln;
writeln(c,d,(d-c) mod 2);
end;
end.

program fff;
var a,b,i,c,x:longint;
s,s1,s2,s3:ansistring;

begin
 readln(s3);
 for i:=1 to length(s3) do
  if (ord(s3[i])<ord('A')) or (ord(s3[i])>ord('Z')) then x:=i;
 a:=x-1;
 s1:=copy(s3,1,x-1);
 delete(s3,1,x-1);
 b:=length(s3)-1;
 s2:=copy(s3,2,b);
 readln(s);
 c:=length(s);
{ writeln(s1,' ',a);
 writeln(s2,' ',b);
 writeln(s,' ',c);}
 if a>b then
    begin
    if c>=a-b then
       begin
        c:=c-a+b;
        s2:=s2+copy(s,1,a-b);
        delete(s,1,a-b);
       end else
       begin
        writeln('Impossible');
        exit;
       end;
    end else
    if b>a then
    begin
    if c>=b-a then
       begin
        c:=c-b+a;
        s1:=s1+copy(s,1,b-a);
        delete(s,1,b-a);
       end else
       begin
        writeln('Impossible');
        exit;
       end;
    end;
 if c mod 2 = 1 then
       begin
        writeln('Impossible');
        exit;
       end;
for i:=1 to c do
  if i mod 2 = 1 then s1:=s1+s[i] else s2:=s2+s[i];
writeln(s1,s3[x],s2);
end.

var
  s,t : ansistring;
  x1,x2 : longint;
begin
  readln(s);
  readln(t);
  x1:=pos('|',s)-1; x2:=length(s)-pos('|',s);
  while length(t) > 0 do begin
    if x1 < x2 then begin inc(x1); insert(t[1],s,1); end else begin inc(x2); insert(t[1],s,length(s)); end;
    delete(t,1,1);
  end;
  if x1 <> x2 then writeln('Impossible') else writeln(s);
end.

  var s,s1:ansistring;
      i,k1,k2:longint;
      u:byte;

begin
   readln(s);
   u:=0;
    for i:=1 to length(s) do
      begin
       if s[i]='|' then u:=1;
       if s[i] in ['A'..'Z'] then if u=0 then inc(k1)
                                         else inc(k2);
      end;
     readln(s1);

     if k1>k2 then  if k2+length(s1)=k1 then writeln(s,s1)
                                        else writeln('Impossible')
              else if k1+length(s1)=k2 then writeln(s1,s)
                                       else writeln('Impossible');

  readln;
{Totusi este trist in lume}
end.

var
    s,f : string;
    i,k,s1,f1 : longint;
begin
    //assign(input,'382A.INP'); reset(input);
    //assign(output,'328A.OUt'); rewrite(output);
    readln(s);
    readln(f);
    k := pos('|',s);
    s1 := length(s);
    f1 := length(f);
    if k - 1 > s1 - k then
    begin
        if f1 = 2*k - 1- s1 then
            write(s,f)
        else
            writeln('Impossible')
    end
    else
    begin
        if f1 = s1 - 2*k + 1 then
            write(f,s)
        else
            writeln('Impossible');
    end;
end.

var s,f,s2,s1:string;
x:longint;
begin
readln(s);
readln(f);
x:=pos('|',s);
s1:=copy(s,1,x-1);
s2:=copy(s,x+1,length(s)-x+1);
while length(f)<>0 do begin
                      if length(s1)<length(s2) then s1:=s1+f[1] else s2:=s2+f[2];
                      delete(f,1,1);
                      end;
if length(s1)=length(s2) then write(s1,'|',s2) else write('Impossible');
end.

var
 s,s1:ansistring;
 k,x,y,i:longint;
begin
 readln(s);
 readln(s1);
 k:=pos('|',s);
 for i:=1 to k-1 do
  if (s[i] in ['A'..'Z']) or (s[i] in ['a'..'z']) then
   inc(x);
 for i:=k+1 to length(s) do
  if (s[i] in ['A'..'Z']) or (s[i] in ['a'..'z']) then
   inc(y);
 if abs(x-y)<>length(s1) then
  begin
   writeln('Impossible');
   halt;
  end;
 if x<y then writeln(s1+s)
            else writeln(s+s1);
end.

var
i,j,c,d,e,b,n:longint;
s,s1,s2,s3:ansistring;
begin
readln(s);
readln(s1);
j:=pos('|',s);
c:=j-1;
s2:=copy(s,1,j-1);
d:=length(s)-j;
s3:=copy(s,j+1,length(s));
if c+length(s1)=d then begin writeln(s1+s2,'|',s3);exit;end;
if d+length(s1)=c then begin writeln(s2,'|',s3+s1);exit;end;
writeln('Impossible');
end.

var s1,s2:string;
    i:byte;

BEGIN
readln(s1);readln(s2);
i:=1;
while s1[i]<>'|' do i:=i+1;
if length(s1)-i=i-1 then begin write('Impossible');halt;end;
        if i>length(s1) div 2 then
                begin
                s1:=s1+s2;
                while length(s1)>i*2+1 do delete(s1,length(s1),1);
                end
        else
                begin
                i:=i+length(s1);
                s1:=s2+s1;
                while length(s1)>i*2+1 do delete(s1,1,1);
                end;
i:=1;
while s1[i]<>'|' do i:=i+1;
if length(s1)-i=i-1 then writeln(s1) else write('Impossible');
END.

program a123;
var     i,j,k,s1,s2:longint;  n:byte;
      s:array[1..2] of  longint;
      a:array[0..10000] of char;
      x:array[1..10000] of char;
procedure inputdata;
  begin

    i:=0;
    while not eoln do
      begin
        inc(I);
        read(x[i]);

        if x[i] <> '|' then inc(s[n]) else  inc(n);
      end;
    readln(a[0]);
    i:=1;
    while not eoln do
      begin
       read(a[i]);

       inc(I);
      end;
    dec(I);
    k:=i;
    s1:=s[1];
    s2:=s[2];

  end;
procedure outputdata;
  begin

    if (k = 0) and (x[1] = '|')then write('|');
      if abs(s[1]-s[2])= k
          then begin
                 if s[1]>s[2] then begin
                                     for i:= 1 to s[1]+s[2]+1 do
                                           write(x[i]);
                                     i:=1;
                                     while s[1] <> s[2] do
                                       begin
                                         write(a[i]);
                                         inc(s[2]);
                                         inc(I);
                                       end;
                                   end;
                 if s[2] > s[1] then begin
                                       i:=1;
                                       while s[1]<>s[2] do
                                         begin
                                           write(a[i]);
                                           inc(s[1]);
                                           inc(i);
                                         end;
                                       for i:= 1 to s[1]+s[2]+1 do
                                         write(x[i]);
                                     end;
               end
      else if s[1]=s[2] then if i mod 2 <> 0 then begin write('Impossible'); exit; end
                        else if s[1]=s[2] then begin
                            for j:= 1 to  trunc(i div 2) do
                               write(a[j]);
                             for j:= 1 to s[1]+s[2]+1 do
                               write(x[j]);
                             for j:= trunc(i div 2)+1 to i do
                               write(a[j]);exit; end;
    if abs( s1-s2) <> k
                                               then write('Impossible');

  end;
begin
  n:=1;
  s[1]:=0;
  s[2]:=0;
  inputdata;

  outputdata;
end.

program project1;

{$mode objfpc}{$H+}
var
  vesy: string;
  other: string;
  symNum: integer;
  leftSymNum: integer;

begin
  readln(vesy);
  symNum:=Pos('|',vesy);
  readln(other);
  if((Length(vesy)-1+Length(other)) mod 2=1) then
    write('Impossible')
  else
  begin
    leftSymNum:=symNum-1-(Length(vesy)-symNum);
    if(abs(leftSymNum)>Length(other)) then
       write('Impossible')
    else
    begin
      insert(Copy(other, 1, (Length(other)-leftSymNum) shr 1), vesy, symNum);
      insert(Copy(other, ((Length(other)-leftSymNum) shr 1), Length(other)), vesy, Length(vesy)+1);
      write(vesy);
    end;
  end;
end.

program project1;

{$mode objfpc}{$H+}
var
  vesy: string;
  other: string;
  symNum: integer;
  leftSymNum: integer;

begin
  readln(vesy);
  symNum:=Pos('|',vesy);
  readln(other);
  if((Length(vesy)-1+Length(other)) mod 2=1) then
    write('Impossible')
  else
  begin
    leftSymNum:=symNum-1-(Length(vesy)-symNum);
    if(abs(leftSymNum)>Length(other)) then
       write('Impossible')
    else
    begin
      insert(Copy(other, 1, (Length(other)-leftSymNum) shr 1), vesy, symNum);
      insert(Copy(other, ((Length(other)-leftSymNum) shr 1), Length(other)), vesy, Length(vesy)+1);
      writeln(vesy);
    end;
  end;
  readln();
end.

var s1,s2,s:ansistring;
    i,len:longint;
    tmp:char;
begin
   readln(s1); readln(s2);
   if s1[1] = '|' then s := s2 + s1 else  s := s1 + s2;
   len := length(s1) + length(s2);
   if len mod 2 = 0 then begin writeln('Impossible'); halt; end;
   for i:=1 to len do begin
     if s[i] = '|' then begin
       tmp := s[i]; s[i] := s[(len+1)div 2]; s[(len+1)div 2] := tmp;
     end;
   end;
   writeln(s);
end.

Program azkaban;
var s,s1,s2,s3 : string;
    k,i,dif,nr : longint;
begin readln(S);
    i:=1;
    while s[i]<>'|' do begin k:=k+1; i:=i+1; end;
    s1:=copy(s,1,k);
    s2:=copy(s,k+2,length(S)-k-1);
    readln(s3);
    dif:=length(s1)-length(s2);
    if (length(S3)+length(s1)+length(s2)) mod 2 <>0 then write('Impossible')
                                          else begin
    i:=1;
    nr:=length(s3);
    while nr <>0 do begin
                            if dif>=0 then begin
                                               s2:=s2+S3[i];
                                               i:=i+1;
                                               nr:=nr-1;
                                               dif:=length(s1)-length(S2);
                                           end
                                      else
                            if dif<0 then begin
                                               s1:=s1+S3[i];
                                               i:=i+1;
                                               nr:=nr-1;
                                               dif:=length(s1)-length(s2);
                                           end;
                             end;
    write(s1,'|',s2);

                     end;

end.

var s1,s2:string;
	i,j,t,k:integer;
begin
	readln(s1);
	readln(s2);
	i:=1;
	while s1[i]<>'|' do
		inc(i);
	j:=i-1; k:=length(s1)-i;
	if i=1 then t:=length(s2)
	else	t:=length(s1)-i+length(s2);
	if (t=j) or (t=k) then
		begin
			if s1[1]='|' then write(s2,s1)
				else write(s1,s2);
		end
	else write('Impossible');
end.

var
        data : ansistring;
        cek : int64;
        tanya : ansistring;
        jawab : ansistring;
        cek2 : int64;
        cek3 : int64;
begin
        readln(data);
        readln(tanya);
       // writeln(length(tanya));
        cek := pos('|',data);
       // writeln(cek);
        if (cek = length(data)) and (length(data) = length(tanya)+1) then begin
                jawab := copy(data,1,length(data)) + copy(tanya,1,length(tanya));
                writeln(jawab);
        end else
        if (cek = 1) and (length(data) = length(tanya)+1) then begin
                jawab := copy(tanya,1,length(tanya)) + copy(data,1,length(data));
                writeln(jawab);
        end else begin
                cek2 := cek-1;
                cek3 := length(data) - cek;
             //   writeln(cek2,' ',cek3,' ',length(tanya));
                if (cek2 + length(tanya) = cek3) then begin
                        jawab := copy(tanya,1,length(tanya)) + copy(data,1,length(data));
                        writeln(jawab);
                end else
                if (cek2 = length(tanya)+cek3) then begin
                        jawab := copy(data,1,length(data)) + copy(tanya,1,length(tanya));
                        writeln(jawab);
                end else
                writeln('Impossible');
        end;
end.

program p1;
var s,t:string;i,k,l,r,d:integer;
begin
readln(s);
readln(t);
for i:=1 to length(s) do
if (s[i]='|') then
begin
k:=i;
break;
end;
r:=length(s)-k;
l:=k-1;
d:=abs(l-r);
if (length(t)<d) or ((length(t)-d)mod 2<>0) then writeln('Impossible')
else
begin
if (l>r) then
begin
for i:=1 to ((length(t)-d) div 2) do write(t[i]);
write(s);
for i:=(((length(t)-d) div 2)+1) to length(t) do write(t[i]);
end
else
begin
for i:=1 to ((length(t)-d)div 2+d) do write(t[i]);
write(s);
for i:=((length(t)-d)div 2+d) to length(t) do write(t[i]);
end;
end;
end.

var
    s,f,s1 : string;
    i,k,r,f1 : longint;
begin
    //assign(input,'382A.INP'); reset(input);
    //assign(output,'328A.OUt'); rewrite(output);
    readln(s);
    readln(f);

    if (length(s) - 1 + length(f)) mod 2 <> 0 then
        writeln('Impossible')
    else
    begin
         r := length(f);
         for i := 1 to length(f) do
            begin
                k := pos('|',s);
                if k - 1 > length(s) - k then
                begin
                    insert(f[i],s,length(s));
                    dec(r);
                    k := pos('|',s);
                    if (k - 1 = length(s) - k) and (r = 0) then break;
                end
                else
                if k - 1 < length(s) - k then
                begin
                    k := pos('|',s);
                    insert(f[i],s,k - 1);
                    dec(r);
                    if (k - 1 = length(s) - k) and (r = 0) then break;
                end
                else
                    if (k - 1 = length(s) - k) and (r > 0) then
                    begin
                        insert(f[i],s,k - 1) ;
                        dec(r);
                        if (r = 0) and (k - 1 = length(s) - k) then break;
                    end;
            end;

     k := pos('|',s);
     if k - 1 = length(s) - k then
        writeln(s)
     else
        writeln('Impossible');
    end ;

end.

var
 s,s1:string;
 a,b,i:longint;
begin
 readln(s);
 readln(s1);
 a:=pos('|',s)-1;
 b:=length(s)-a-1;
 if(length(s1)-abs(a-b))and 1=0 then
 begin
  for i:=1to length(s1)do
  begin
   if a>b then
   begin
    inc(b);
    s:=s+s1[i];
   end
   else
   begin
    inc(a);
    s:=s1[i]+s;
   end;
  end;
  writeln(s);
 end
 else
 writeln('Impossible');
end.

program codeforces_round224_a;

var
  s1, s2 : string;

begin
  readln(s1);
  readln(s2);
  while length(s2) <> 0 do
    begin
      if pos(chr(179), s1) > (length(s1) + 1) div 2
         then s1:=s1 + s2[1]
         else insert(s2[1], s1, 1);
      delete(s2, 1, 1);
    end;
  if pos(chr(179), s1) <> (length(s1) + 1) div 2
     then write('impossible')
     else write(s1);

end.

var t:char;
    left,right,none:string;
begin
    left:='';
    right:='';
    while not(seekeoln) do
    begin
        read(t);
        if t<>'|' then right:=right+t
        else begin left:=right; right:=''; end;
    end;
    readln;
    readln(none);
    if (length(none)+length(right)<>length(left))and(length(none)+length(left)<>length(right)) then writeln('Impossible')
    else
    begin
        if length(none)+length(left)=length(right) then writeln(none,left,'|',right)
        else writeln(left,'|',none,right);
    end;
end.

var
        data : ansistring;
        cek : longint;
        i,j : longint;
        tanya : ansistring;
        jawab : ansistring;
        cek2 : longint;
        cek3 : longint;
begin
        readln(data);
        readln(tanya);
       // writeln(length(tanya));
        cek := pos('|',data);
       // writeln(cek);
        if (cek = length(data)) and (length(data) = length(tanya)+1) then begin
                jawab := copy(data,1,length(data)) + copy(tanya,1,length(tanya));
                writeln(jawab);
        end else
        if (cek = 1) and (length(data) = length(tanya)+1) then begin
                jawab := copy(tanya,1,length(tanya)) + copy(data,1,length(data));
                writeln(jawab);
        end else begin
                cek2 := cek-1;
                cek3 := length(data) - cek;
             //   writeln(cek2,' ',cek3,' ',length(tanya));
                if cek2 + length(tanya) = cek3 then begin
                        jawab := copy(tanya,1,length(tanya)) + copy(data,1,length(data));
                        writeln(jawab);
                end else
                if cek2 = length(tanya)+cek3 then begin
                        jawab := copy(data,1,length(data)) + copy(tanya,1,length(tanya));
                        writeln(jawab);
                end else
                writeln('Impossible');
        end;
end.

  var s,s1:ansistring;
      i,k1,k2:longint;
      u:byte;

begin s:='';
   readln(s);
   u:=0; s1:=''; k1:=0;k2:=0;
    for i:=1 to length(s) do
      begin
       if s[i]='|' then u:=1;
       if s[i] in ['A'..'Z'] then if u=0 then inc(k1)
                                         else inc(k2);
      end;
     readln(s1);

     if k1>k2 then  if k2+length(s1)=k1 then writeln(s,s1)
                                        else writeln('Impossible')
              else if k1+length(s1)=k2 then writeln(s1,s)
                                       else writeln('Impossible');

  readln;
{Totusi este trist in lume}
end.

program form;
var s, ss: string;
n,m,i,j,k: longint;

begin
//assign (input, 'input.txt');reset (input);
//assign (output, 'output.txt'); rewrite (output);
readln (s);
for i:= 1 to length (s) do
if s[i] = '|' then break;
readln (ss);

if (length (s) + length (ss)) mod 2 =0 then
begin writeln ('Impossible'); halt; end;

m:=  (length (s) + length (ss)) div 2;
if (i-1<= m) and (length (s)-i <=m)
then
else begin writeln ('Impossible'); halt; end;
j:= 1;
for k:= 1 to m do
begin
if (k<i) then write (s[k]);
if k>i then begin write (ss[j]); inc (j); end;
end;
write (s[i]);
for k:= i to length (s) do
write (s[k]);
for k:= j to length (ss) do
write (ss[k]);

//close (input); close (output);
end.

var
 s,s1:ansistring;
 k,x,y,i:longint;
begin
 readln(s);
 readln(s1);
 k:=pos('|',s);
 for i:=1 to k-1 do
  if (s[i] in ['A'..'Z']) or (s[i] in ['a'..'z']) then
   inc(x);
 for i:=k+1 to length(s) do
  if (s[i] in ['A'..'Z']) or (s[i] in ['a'..'z']) then
   inc(y);
 if abs(x-y)<>length(s1) then
  begin
   writeln('Impossible');
   halt;
  end;
 if x<y then writeln(s1+s)
            else writeln(s+s1);
end.

program v;
var s,b:string;
k,k1,k2,i,o:integer;
begin
readln(s);
readln(b);
for i:=1 to length(s)do
if s[i]='|' then
k:=i;
k1:=k-1;
k2:=length(s)-k;
o:=(abs(k1-k2));
if (o>length(b))or((length(b)-o) mod 2=1) then
writeln('Impossible')else
if k1>k2 then
begin
for i:=1 to (length(b)-o)mod 2 do
write(b[i]);
write(s);
for i:=(length(b)-o)mod 2+1 to length(b) do
write(b[i]);
end else
begin
for i:=(length(b)-o)mod 2+1 to length(b) do
write(b[i]);
write(s);
for i:=1 to (length(b)-o)mod 2 do
write(b[i]);
end;
end.

Var i,j,k,l,n,m,t,c,r : Longint;
    s,s1 : ansistring;
function Max(a,b : Longint) : Longint;
begin
   If (a > b) Then max := a
   else max := b;
End;

Begin
   Readln(s);
   i := 1;
   While s[i] <> '|' Do
     Begin
        Inc(l);
        inc(i);
     End;
   r := length(s) - l - 1;
   Readln(s1);
   c := abs(r - l);
   if (length(s1) - c < 0) or ((length(s1) - c) mod 2 <> 0) Then
        Begin
           Writeln('Impossible');
        exit;
        End;
   k := 1;
   Dec(c,length(s1));
   c := c div 2;
   t := max(l,r) + c;
   For i := 1 To l Do
      Write(s[i]);
   For i := 1 To t - l do
      write(s1[i]);
   Write('|');
   For i := l + 2 to length(s) Do
      Write(s[i]);
   For i := t - l + 1 To length(s1) do
     Write(s1[i]);
   Writeln();
End.

var s,f,s2,s1:string;
x:longint;
begin
readln(s);
readln(f);
x:=pos('|',s);
s1:=copy(s,1,x-1);
s2:=copy(s,x+1,length(s)-x+1);
while length(f)<>0 do begin
                      if length(s1)<length(s2) then s1:=s1+f[1] else s2:=s2+f[2];
                      delete(f,1,1);
                      end;
if length(s1)=length(s2) then write(s1,'|',s2) else write('Impossible');
end.

var a,b:ansistring;
    i,l,r,num:longint;
begin
readln(a);
readln(b);
l:=0;
while (a[l+1]<>'|') do inc(l);
r:=length(a)-l-1;num:=length(a)-1+length(b);
if num mod 2=1 then begin write('Impossible');halt;end;
for i:=((length(b)+r-l)div 2) downto 1 do a:=b[i]+a;
for i:=((length(b)+r-l)div 2) +1 to length(b) do a:=a+b[i];
writeln(a);
end.

program a123;
var     i,j,k,s1,s2:longint;  n:byte;
      s:array[1..2] of  longint;
      a:array[0..10000] of char;
      x:array[1..10000] of char;
procedure inputdata;
  begin

    i:=0;
    while not eoln do
      begin
        inc(I);
        read(x[i]);

        if x[i] <> '|' then inc(s[n]) else  inc(n);
      end;
    readln(a[0]);
    i:=1;
    while not eoln do
      begin
       read(a[i]);

       inc(I);
      end;
    dec(I);
    k:=i;
    s1:=s[1];
    s2:=s[2];
      end;
procedure outputdata;
  begin

    if k = 0 then if s[1] = s[2] then begin for j:= 1 to s[1]+s[2]+1 do write(x[j]); exit end
         else begin write('Impossible'); exit; end;
      if (s[1]+s[2]+ k) mod 2 = 0
          then begin
                 for i := 1 to ((k+s[1]+s[2]) div 2) - s[1] do

                   write(a[i]);
                 for i:= 1 to s[1]+s[2]+1 do
                   write(x[i]);
                 for i:=((k +s[1]+s[2])div 2) -s[1] +1 to k do
                   write(a[i]);
                 exit;
               end
      else if s[1]=s[2] then if i mod 2 <> 0 then begin write('Impossible'); exit; end
                        else if s[1]=s[2] then begin
                            for j:= 1 to  trunc(i div 2) do
                               write(a[j]);
                             for j:= 1 to s[1]+s[2]+1 do
                               write(x[j]);
                             for j:= trunc(i div 2)+1 to i do
                               write(a[j]);exit; end;
    if abs( s1-s2) <> k then
                                                write('Impossible');

  end;
begin
  n:=1;
  s[1]:=0;
  s[2]:=0;
  inputdata;

  outputdata;
end.

var
 s,s1:ansistring;
 k,x,y:longint;
begin
 readln(s);
 readln(s1);
 k:=pos('|',s);
 x:=length(copy(s,1,k-1));
 y:=length(copy(s,k+1,length(s)));
 if abs(x-y)<>length(s1) then
  begin
   writeln('Impossible');
   halt;
  end;
 if x<y then writeln(s1+s)
            else writeln(s+s1);
end.

var s,f,s2,s1:string;
x:longint;
begin
readln(s);
readln(f);
x:=pos('|',s);
s1:=copy(s,1,x-1);
s2:=copy(s,x+1,length(s)-x+1);
while length(f)<>0 do begin
                      if length(s1)>length(s2) then s1:=s1+f[1] else s2:=s2+f[2];
                      delete(f,1,1);
                      end;
if length(s1)=length(s2) then write(s1,'|',s2) else write('Impossible');
end.

var
t,x,y,s:ansistring;
j,k:longint;
begin
readln(x);
readln(y);
j:=pos('|',x);
s:=copy(x,1,j-1);
delete(x,1,j);

if length(x)>length(s) then begin t:=x;x:=s;s:=t;end;
if length(x)+length(y)<length(s) then begin writeln('Impossible');halt;end;
k:=length(x)+length(y)+length(s);
if (k and 1=1)then begin writeln('Impossible');halt;end;
k:=k div 2;
k:=k-length(x);
x:=x+copy(y,1,k);
delete(y,1,k);
s:=s+y;
writeln(s,'|',x);

end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  t=record
    i,x,cnt:integer;
  end;
var
  a,b,c:array[1..100100]of integer;
  n,i,j,k,l,r,m,x,y,max,min,d:integer;
  cnt,sum,p,kol:int64;
  q,w,e:boolean;
  s,s1:string;

begin
  readln(s);
  readln(s1);
  l:=0;
  r:=0;
  q:=false;
  sum:=length(s)-1+length(s1);
  for i:=1 to length(s) do
  begin
    if not(q)and(s[i]<>'|')then
      inc(l)
    else if(s[i]='|')then
    begin
      q:=true;
      x:=i;
    end
    else if(q)then
      inc(r);
  end;
  if(length(s1)<abs(r-l))or(r=l)then
    writeln('Impossible')
  else
  begin
      for i:=1 to x-1 do
        write(s[i]);
      for i:=x to sum div 2 do
        write(s1[i-x+1]);
      y:=i-x;
      write('|');
      for i:=x+1 to length(s) do
        write(s[i]);
      for i:=y+1 to length(s1)do
        write(s1[i]);
  end;
  readln;
  readln;
end.

var s1,s2,s:ansistring;
    i:longint;
begin
   readln(s1); readln(s2);
   s := s1 + s2;
   if length(s) mod 2 = 0 then begin
      for i:=1 to length(s) do begin
         if i <> length(s) then write(s[i])
         else write('|');
      end;
   end
   else write('Imposible');
   writeln;
end.

var s1,s2:string;
    i:byte;

BEGIN
readln(s1);readln(s2);
i:=1;
while s1[i]<>'|' do i:=i+1;
//if length(s1)-i=i-1 then begin write('Impossible');halt;end;
while ((length(s1)-i<>i-1) or (length(s2)>1))and(length(s2)>0) do
        begin
        if length(s1)-i=i-1 then
                begin
                s1:=s2[1]+s1+s2[2];
                delete(s2,1,2);
                i:=i+1;
                end
        else if length(s1)-i<i-1 then
                begin
                s1:=s1+s2[1];
                delete(s2,1,1);
                end
        else if length(s1)-i>i-1 then
                begin
                s1:=s2[1]+s1;
                delete(s2,1,1);
                i:=i+1;
                end;
        end;
if odd(length(s1)) and (i=length(s1) div 2+1) then write(s1) else write('Impossible');
END.

var s,p:string; a,b,c:byte;
begin
    readln(s); readln(p);
    a:=pos('|',s)-1; b:=length(s)-pos('|',s); c:=length(p);
    if (c+a=b) then writeln(p,s) else
    if (a=b+c) then writeln(s,p) else
    if (a+b=c) then writeln(copy(p,1,b),s,copy(p,b+1,a)) else
    if ((a=b) and (c mod 2=0)) then
    writeln(copy(p,1,c div 2),s,copy(p,c div 2+1,c div 2))  else
    if ((a+b+c) mod 2=0) then
    writeln(copy(p,1,(a+b+c) div 2-a),s,copy(p,(a+b+c) div 2-a+1,(a+b+c) div 2-b))
    else writeln('Impossible');
end.

var i,n,l,r,f: longint; a,b,o: string;
begin
  readln(a);
  n:=length(a);
  for i:=1 to n do
  if a[i]='|' then
  begin
    l:=i-1;
    r:=n-i;
    break
  end;
  readln(b);
  if (l>r) then f:=length(b)-l+r
           else f:=length(b)-r+l;
  if (f>-1) and ((f mod 2)=0) then
  begin
    if (l>r) then
    o:=copy(a,1,l)+copy(b,1,f mod 2)+'|'+copy(a,l+2,r)+copy(b,(f mod 2)+1,length(b))
    else o:=copy(a,1,l)+copy(b,(f mod 2)+1,length(b))+'|'+copy(a,l+2,r)+copy(b,1,f mod 2);
    writeln(o);
  end
                          else writeln('Impossible');
end.

program v;
var s,b:string;
k,k1,k2,i,o:integer;
begin
readln(s);
readln(b);
for i:=1 to length(s)do
if s[i]='|' then
k:=i;
k1:=k-1;
k2:=length(s)-k;
o:=(abs(k1-k2));
if (o>length(b))or((length(b)-o) mod 2=1) then
begin
writeln('Impossible');
halt(0);
end else
if k1>k2 then
begin
for i:=1 to (length(b)-o)mod 2 do
write(b[i]);
write(s);
for i:=(length(b)-o)mod 2+1 to length(b) do
write(b[i]);
end else
begin
for i:=(length(b)-o)mod 2+1 to length(b) do
write(b[i]);
write(s);
for i:=1 to (length(b)-o)mod 2 do
write(b[i]);
end;
end.

var i,t1,t2,q,r :longint;
   s1,s2,ss1,ss2,ss:string;
   ok:boolean;
  begin
    readln(s1);
    readln(s2);
    ok:=false;
    for i:=1 to length(s1) do
     begin
      if (s1[i]='|') then begin ok:=true; continue; end;
      if ok then begin inc(t2); ss2:=ss2+s1[i] end
      else begin inc(t1); ss1:=ss1+s1[i];end;
     end;

    if t1<t2 then begin
                     q:=t2-t1;
                     if q>length(s2) then begin writeln('Impossible'); halt; end;
                     for i:=1 to q do
                      ss1:=ss1+s2[i];
                     if (length(s2)-q) mod 2=0 then begin
                                                      r:=(length(s2)-q) div 2;
                                                      if r<>0 then begin
                                                      for i:=q+1 to r do
                                                       ss1:=ss1+s2[i];
                                                       for i:=r+1 to length(s2) do
                                                        ss2:=ss2+s2[i];
                                                        end;
                                                      ss:=ss1+'|'+ss2;
                                                      writeln(ss);
                                                      halt;
                                                    end
                                                    else begin writeln('Impossible'); halt; end;
                  end
     else begin
     q:=t1-t2;
            if q>length(s2) then begin writeln('Impossible'); halt; end;
                     for i:=1 to q do
                      ss2:=ss2+s2[i];
                     if (length(s2)-q) mod 2=0 then begin
                                                      r:=(length(s2)-q) div 2;
                                                      if r<>0 then begin
                                                      for i:=q+1 to r do
                                                       ss2:=ss2+s2[i];
                                                       for i:=r+1 to length(s2) do
                                                        ss1:=ss1+s2[i];
                                                        end;
                                                      ss:=ss1+'|'+ss2;
                                                      writeln(ss);
                                                      halt;
                                                    end
                                                    else begin writeln('Impossible'); halt; end;
          end;
  end.

Program azkaban;
var s,s1,s2,s3 : string;
    k,i,dif,nr : longint;
begin readln(S);
    i:=1;
    while s[i]<>'|' do begin k:=k+1; i:=i+1; end;
    s1:=copy(s,1,k);
    s2:=copy(s,k+2,length(S)-k-1);
    readln(s3);
    dif:=length(s1)-length(s2);
    if (length(s3)<dif) then write('Impossible')
                        else
    if ((length(s1)+length(s2)+length(s3)) mod 2<>0) then write('Impossible')
                                  else begin
    i:=1;
    nr:=length(s3);
    while nr <>0 do begin
                            if dif>=0 then begin
                                               s2:=s2+S3[i];
                                               i:=i+1;
                                               nr:=nr-1;
                                               dif:=length(s1)-length(S2);
                                           end
                                      else
                            if dif<0 then begin
                                               s1:=s1+S3[i];
                                               i:=i+1;
                                               nr:=nr-1;
                                               dif:=length(s1)-length(s2);
                                           end;
                             end;
    write(s1,'|',s2);

                     end;

end.

Var

s2,q1,q2: string;
s : char;
i,j,k1,k2,z,t,t2,t3,x,y : integer;

Begin
 z:=1;
 While not eoln do begin
       Read (s);
       If s = '|' then begin
           z:=2;
           continue
       end;
       If z=1 then begin k1:=k1+1; q1:=q1+s; end;
       If z=2 then begin k2:=k2+1; q2:=q2+s; end;
 end;
 Readln;
 Read (s2);
 t := length (s2);
 If k1<k2 then begin
    If k2-k1 > t then begin
       Write ('Impossible');
       Halt;
    end Else begin
             t2:=t-(k2-k1);
             If t2 mod 2 = 1 then begin
                Write ('Impossible');
                Halt;
             end Else begin
                      For i:= 1 to (k2-k1) do begin
                          q1:=q1+s2[i];
                          j:=i;
                      end;
                      If t2 = 0 then begin
                         Writeln (q1,'|',q2);
                         halt;
                      end;
                      t3:=t2 div 2;
                      y:=t3;
                       x:=1;
                      While y > 0 do begin
                          q1:=q1+s2[x];
                          inc (x);
                          dec (y);
                      end;
                      y:=t3;
                      While y > 0 do begin
                          q2:=q2+s2[x];
                          inc (x);
                          dec (y);
                      end;
                      Writeln (q1,'|',q2);
                 end;
        end;
 end;

 If k1>k2 then begin
    If k1-k2 > t then begin
       Write ('Impossible');
       Halt;
    end Else begin
             t2:=t-(k1-k2);
             If t2 mod 2 = 1 then begin
                Write ('Impossible');
                Halt;
             end Else begin
                      For i:= 1 to (k1-k2) do begin
                          q2:=q2+s2[i];
                          j:=i;
                      end;
                      If t2 = 0 then begin
                         Writeln (q1,'|',q2);
                         halt;
                      end;
                      t3:=t2 div 2;
                      y:=t3;
                       x:=1;
                      While y > 0 do begin
                          q2:=q2+s2[x];
                          inc (x);
                          dec (y);
                      end;
                      y:=t3;
                      While y > 0 do begin
                          q1:=q1+s2[x];
                          inc (x);
                          dec (y);
                      end;
                      Writeln (q1,'|',q2);
                 end;
        end;
 end;

 If k1=k2 then begin

   t2 := t;
   If t2 mod 2 = 1 then begin
                Write ('Impossible');
                Halt;
   end;

                      t3:=t2 div 2;
                      y:=t3;
                      x:=1;
                      While y > 0 do begin
                          q2:=q2+s2[x];
                          inc (x);
                          dec (y);
                      end;
                      y:=t3;
                      While y > 0 do begin
                          q1:=q1+s2[x];
                          inc (x);
                          dec (y);
                      end;
                      Writeln (q1,'|',q2);

 end;
end.

var
 s,s1:string;
 a,b,i:longint;
begin
 readln(s);
 readln(s1);
 a:=pos('|',s)-1;
 b:=length(s)-a-1;
 if(length(s1)-abs(a-b))and 1=0 then
 begin
  for i:=1to length(s1)do
  begin
   if a>b then
   begin
    inc(b);
    s:=s+s1[i];
   end
   else
   begin
    inc(a);
    s:=s1[i]+s;
   end;
  end;
  writeln(s);
 end
 else
 writeln('Impossible');
end.

program codeforces_round224_a;

var
  s1, s2 : string;

begin
  readln(s1);
  readln(s2);
  while length(s2) <> 0 do
    begin
      if pos(chr(179), s1) > (length(s1) + 1) div 2
         then s1:=s1 + s2[1]
         else insert(s2[1], s1, 1);
      delete(s2, 1, 1);
    end;
  if pos(chr(179), s1) <> (length(s1) + 1) div 2
     then write('impossible')
     else write(s1);

end.

program project1;

var
  vesy: string;
  other: string;
  symNum: integer;
  leftSymNum: integer;

begin
  readln(vesy);
  symNum:=Pos('|',vesy);
  readln(other);
  if((Length(vesy)-1+Length(other)) mod 2=1) then
    writeln('Impossible')
  else
  begin
    leftSymNum:=symNum-1-(Length(vesy)-symNum);
    if(abs(leftSymNum)>Length(other)) then
       writeln('Impossible')
    else
    begin
      insert(Copy(other, 1, (Length(other)-leftSymNum) shr 1), vesy, symNum);
      insert(Copy(other, ((Length(other)-leftSymNum) shr 1), Length(other)), vesy, Length(vesy)+1);
      writeln(vesy);
    end;
  end;
end.