program yan;
  var s,s1,s2:string; i,j,x,y,n,m:integer;
begin
  readln(s);
  readln(s1);
  for i:=1 to length(s) do
    if s[i]<s1[i] then
      begin
        write(-1); exit;
      end;
  write(s1);
end.

const fi='';
    fo='';
var f:text;
    x,y,z:string;
procedure input;
begin
    assign(f,fi);reset(F);
    readln(f,x);
    read(F,y);
    close(F);
end;
function min(a,b:string):string;
begin
    if (a<b) then exit(A);
    exit(b);
end;
procedure process;
var  i:byte;
begin
    for i:=1 to length(X) do z:=z+min(x[i],y[i]);
    assign(f,fo);rewrite(F);
    for i:=1 to length(y) do
            if (z[i]<y[i]) then
            begin
                write(f,-1);
                close(F);
                halt;
            end;
    write(f,z);
    close(F);
end;

begin
    input;
    process;
end.

var a,a1,ta,d,tb,b,b1,tf,e,du,i,j,k,n,m,cr,r,h,t,du1,max:Longint;
var count:Qword;
type d2a=array[1..1000000] of Longint;
var ar:array[1..200000] of longint;
var sa:array[1..1000] of string;
var gr,er:d2a;
var super:Qword;
var s,s1,x:ansistring;
var cha,chara:char;
var f1,f2:text;
begin
        readln(s);
        readln(s1);
        for i:=1 to length(s) do
        begin
                iF(s[i]<s1[i]) then
                begin
                        writeln(-1);
                        halt;
                end;
        end;
        writeln(s1);

end.

var x,y,z:string;
    f,i:longint;
begin
    readln(x);
    readln(y);
    for i:=1 to length(x) do
        begin
            if ord(x[i])<ord(y[i]) then f:=-1;
        end;
    if f=-1 then writeln(f) else writeln(y);
end.

var
  x, z, y: string;
  n, i, k, l: integer;

begin
  readln(x);
  readln(z);
  for i := 1 to length(x) do
  begin
    if (ord(x[i]) >= ord(z[i])) then
      y := y + z[i];
    if (ord(x[i]) < ord(z[i])) then
    begin
      y := '-1';
      break;
    end;
  end;
  writeln(y);
end.

var
  s1,s2,s3 : string;
  i : longint;
begin
  readln(s1);
  readln(s2);
  for i:=1 to length(s1) do
    begin
      if s1[i]=s2[i] then s3:=s3+s1[i] else
      if s1[i]<s2[i] then begin writeln(-1); halt; end else
      s3:=s3+s2[i];
    end;
  writeln(s3);
end.

var x,y:ansistring; i:longint;
begin
  readln(x); readln(y);
  for i:=1 to length(x) do
    if x[i]<y[i] then
    begin write(-1); halt end;
  write(y)
end.

var
  x,y:string;
  n,i:longint;
  ok:boolean;

begin
  readln(x);
  readln(y);
  n:=length(x);
  ok:=true;
  for i:=1 to n do
    if x[i]<y[i]
      then ok:=false;
  if ok
    then writeln(y)
    else writeln(-1)
end.

program HelloWorld;
var x,y,z:string;
    ch:char;
    i,l,test,a:integer;
begin
readln(x);
readln(z);
{x:='ab';
z:='ba';}
y:=x;
test:=1;
l:=length(x);
for i:=1 to l do
begin
if (x[i]=z[i]) then
begin
a:=ord(x[i]);
a:=a+1;
if a>122 then
a:=122;
ch:=chr(a);
y[i]:=ch;
{writeln(ord(x[i]));
writeln(a);
writeln(ch);}
end
else
begin
        if (x[i]>z[i]) then
        y[i]:=z[i]
        else
        begin
        writeln('-1');
        test:=0;
        break;
        end;
        end;

    end;
    if test=1 then
    writeln(y);
end.

program vk;
var a,b,c:string;
    i:byte;
    flag:boolean;
begin
   readln(a);
   read(c);
   flag:=true;
   for i:= 1 to length(a) do
   begin
      if a[i]< c[i] then
      begin
         flag:=false;
         break;
      end;
   end;
   if flag then
   begin
      write(c);
   end
   else
   begin
      write(-1);
   end;
end.

var a,s,d,f : integer;
z,x,c,v: string;
begin
  readln (z);
  read (x);

    for a:=1 to length(x) do
    if ord(x[a])>ord(z[a]) then begin
                                  write (-1);
                                  exit;
                                end;

                                for a:=1 to length(x) do
                                 write (x[a]);

end.

var x,y,z:string;i:integer; f:boolean;
begin
        readln(x);
        readln(z);
        f:=true;
        y:='';
        for i:=1 to length(x) do
        begin
                if ord(x[i])=ord(z[i]) then
                begin
                        if chr(ord(z[i])+1)='{' then y:=y+'z'
                        else y:=y+chr(ord(z[i])+1);
                end;
                if ord(x[i]) > ord(z[i]) then y:=y+z[i];
                if ord(x[i]) < ord(z[i]) then
                begin
                        f:=false; break;
                end;
        end;
        if f=true then write(y) else write(-1);
end.

var
 s,s1,s2:ansistring;
 c,c1,c2:char;
 i,j,n,m,k,sc:longint;
function min(a,b:char):char;
begin
 if a<b then min:=a else min:=b;
end;
begin
 readln(s1);
 readln(s2);
 for i:=1 to length(s1) do
 begin
  if s1[i]=s2[i] then begin s:=s+s1[i]; continue; end;
  if s1[i]<s2[i] then begin writeln(-1); halt; end;
  s:=s+min(s1[i],s2[i]);
 end;
 writeln(s);
end.

program ideone;
var
  x,y:string;
  i:longint;
  c:boolean;
begin
    readln(x);
    readln(y);
    c:=true;
    for i:=1 to length(x) do
    	if x[i]<y[i] then
    		c:=false;
    if c then write(y)
    else write(-1);
end.

var s1,s2,s3:string;
    i:longint;
begin
readln(s1);
readln(s3);
s2:='';
for i:=1 to length(s1) do
   begin
           if s1[i]<  s3[i] then
             begin
               write(-1);
               exit;
             end;
   end;
write(s3);
end.

var a,b,c:ansistring;
i:longint;
begin
//assign(input,'yjzdys.in');reset(input);
//assign(output,'yjzdys.out');rewrite(output);
readln(a);readln(b);
for i:=1 to length(a) do
  begin
  if a[i]<b[i] then
    begin writeln(-1);close(input);close(output);halt;end;
  if a[i]=b[i] then c:=c+a[i];
  if a[i]>b[i] then c:=c+b[i];
  end;
writeln(c);
close(input);close(output);
end.

var s,ss:string;
i:Longint;
begin
//assign(input,'yjzdys.in');reset(input);
//assign(output,'yjzdys.out');rewrite(output);
readln(s);
readln(ss);
for i:=1 to length(s) do
  if s[i]<ss[i] then
    begin
    writeln(-1);
    close(input);close(output);
    halt;
    end;
for i:=1 to length(s) do
  if s[i]=ss[i] then
    begin
    if ss[i]='z' then
      write(ss[i])
    else
      write(succ(ss[i]))
    end
  else
    write(ss[i]);
close(input);close(output);
end.

var x,y,z:string;
i:longint;

begin
//assign(input,'yjzdys.in');reset(input);
//assign(output,'yjzdys.out');rewrite(output);
readln(x);readln(y);
for i:=1 to length(x) do
  if y[i]>x[i] then
    begin
    writeln(-1);
    close(input);close(output);halt;
    end
  else z:=z+y[i];
writeln(z);

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

var
        x,y,ans:string;
        i:integer;
begin
readln(x);
readln(y);
setlength(ans, length(x));
for i:=1 to length(x) do
        if x[i]<y[i] then
                begin
                writeln(-1);
                halt;
                end
                else
                ans[i]:=y[i];
writeln(ans);
end.

program z2;
var
    x,y,z:string;
    n,i:integer;
    f:boolean;
begin
    readln(x);
    readln(y);
    z:='';
    n:=length(y);
    f:=true;
    for i:=1 to n do begin
        if ord(x[i])<ord(y[i]) then f:=false else begin
            if ord(x[i])=ord(y[i]) then z:=z+'z';
            if ord(x[i])>ord(y[i]) then z:=z+y[i];
        end;
        if f=false then break;
    end;
    if f=false then write(-1) else write(z);
end.

var
  a,b,i,n,k,j,m,p:longint;
  t,s,x:string;
  was:array[1..111111]of boolean;
begin
  readln(s);
  readln(t);

  for i:=1 to length(s) do
  begin
    if (s[i]<t[i]) then begin writeln(-1);halt;end;
    if (s[i]=t[i]) then x:=x+chr(ord(s[i])) else
    if t[i]>s[i] then x:=x+s[i] else x:=x+t[i];
  end;

  writeln(x);
end.

var
   x,y,z:string;
   f:boolean;
   i,j,ans:longint;
begin
   readln (x);
   readln (y);
   f:=true;
   z:='';
   for i:=1 to length(x) do
   begin
      if (x[i]=y[i])then
{         if y[i]<>'z' then}
            z:=z+x[i]
{         else z[i]:='y'}
      else
      begin
         if y[i]<x[i] then z:=z+y[i] else begin f:=false;  break; end;
      end;
   end;
   if f then write (z) else write(-1);
end.

var s1,s2:ansistring;
        i:longint;
begin
        REadln(s1);
        readln(s2);
        for i:=1 to length(s1) do
        Begin
                if s1[i]<s2[i] then
                Begin
                        WRiteln(-1);
                        exit;
                End;
        end;
        write(s2);
end.

var x,y:ansistring; i:longint;
begin
  readln(x); readln(y);
  for i:=1 to length(x) do
    if x[i]<y[i] then
    begin write(-1); halt end;
  write(y);
end.

var
  x,y:string;
  n,i:longint;
  ok:boolean;

begin
  readln(x);
  readln(y);
  n:=length(x);
  ok:=true;
  for i:=1 to n do
    if x[i]<y[i]
      then ok:=false;
  if ok
    then writeln(y)
    else writeln(-1)
end.

var
 a,b:array[1..1000] of longint;
 d:char;
 p:boolean;
 n,i,j,l,m,max:Longint;
begin
 n:=0;
  while (true) do
   begin
    read(d);
    inc(n);
    if (ord(d)>=ord('a')) and (ord(d)<=ord('z')) then a[n]:=ord(d) else break;
   end;
  dec(n);
  readln;
  p:=true;
 for i:=1 to n do
  begin
   read(d);
   b[i]:=ord(d);
   if (b[i]>a[i]) then p:=false;
  end;
 if p=false then begin writeln(-1); exit; end;
 for i:=1 to n do
  write(chr(b[i]));

end.

var x, y: string;
    i: longint;

begin
    readln(x);
    readln(y);
    for i := 1 to length(x) do
        if x[i] < y[i] then begin
            write(-1);
            exit;
        end;
    write(y);
end.

var
p:char;

s,ss:string;
kol,j,i:longint;
bol:boolean;
a:array[-10000..100000]of char;

begin
bol:=true;
readln(s);
readln(ss);
bol:=true;
for i:=1 to length(s) do begin
    if ord(s[i])<ord(ss[i]) then bol:=false;
    if ord(s[i])=ord(ss[i]) then a[i]:='z';
    if ord(s[i])>ord(ss[i]) then a[i]:=ss[i];
end;
if bol=false then writeln(-1)
else begin
    for i:=1 to length(s) do write(a[i]);
end;
end.

uses math;
const
	fi = '';
	fo = '';
	maxn = 100001;
var x,y,z:string; i,j,n:longint; check:boolean;
	f1,f2:text;
begin
	assign(f1,fi); reset(f1);
	assign(f2,fo); rewrite(f2);
	readln(f1,x);
	readln(f1,y);
	n:=length(x);
	check:=true;
	for i:=1 to n do
	begin
		if x[i]=y[i] then z:=z+'z'
		else
			if x[i]<y[i] then check:=false
			else z:=z+y[i];
	end;
	if check then writeln(f2,z) else writeln(f2,-1);
	close(f1); close(f2);
end.

var x,y,z:ansistring;
    n,i:integer;
    kt:boolean;

  begin
   readln(x);
   readln(z);
   kt:=true;y:=x;n:=length(x);
   //neu x[i]=z[i] thi y[i]=chr(ord(x[i])+1) hoac neu x[i]<>z[i] thi y[i]=z[i];
  for i:=1 to n do
       if x[i]=z[i] then
           y[i]:=x[i]
        else
        if x[i]>z[i] then
           y[i]:=z[i]
        else
         begin
          kt:=false;
          break;
         end;
    if not kt then write(-1)
    else write(y);
end.

program B;

var wronglet : boolean;
	i : integer;
	x, z : string;
BEGIN
	readln(x);
	readln(z);
	for i := 1 to length(x) do
	if (ord(x[i])<ord(z[i])) then wronglet := true;
	if wronglet then writeln('-1')
	else writeln(z);
END.

var
x,y,z:string;
a:char;
i,j,k:longint;
begin
readln(x);
readln(y);
z:='';
for i:=1 to length(x) do begin
 if (y[i]<x[i]) then begin
  z:= z + y[i];
  end
 else if (y[i]>x[i]) then begin
  writeln('-1');
  exit;
 end
 else if (y[i]=x[i]) then begin
  z:= z + 'z';
  end;
end;

write(z);
writeln;
end.

var
 x,y,z :string;
 i : longint;

begin
	readln(x);
	readln(y);
	z:='';
	for i:= 1 to length(x) do begin
		z:=z+' ';
		if(x[i]<y[i])then begin
			writeln(-1);
			exit;
		end
		else if(x[i]>y[i])then begin
			z[i]:=y[i];
		end
		else begin
			z[i]:=x[i];
		end;
	end;
	writeln(z);
end.

var
sss:array[1..100000]of char;
s,s1:string;
i:longint;
bol:boolean;
begin
bol:=true;
readln(s);
readln(s1);
for i:=1 to length(s) do begin
    if s[i]=s1[i] then begin
        sss[i]:='z';
    end
    else begin
    if s[i]<s1[i] then bol:=false;
        sss[i]:=s1[i];
    end;

end;

if bol then for i:=1 to length(s) do write(sss[i])
else
writeln(-1);
end.

var x,z,y:string;
a,b,c,i:integer;
begin

  readln(x);
  readln(z);
  y:='';
  for i:=1 to length(x) do begin
    a:=ord(x[i]); b:=ord(z[i]);
    if a=b then c:=a;
    if a>b then c:=b;
    if a<b then c:=-1;
    if (c<ord('a'))or(c>ord('z')) then begin
      y:='-1';
      break;
      end else y:=y+chr(c);

  end;
  writeln(y);

end.

program S801B;
var
s1, s2 : string;
i, j, k : integer;

function y(x, z: string ) : string;
var
temp : string;
begin
temp:='';
for i:=1 to length(x) do
   begin
     if ((x[i])=z[i]) then
       begin
         temp:=temp+x[i];
       end
       else if (x[i]>z[i]) then
       begin
         temp:=temp+z[i];
       end
       else
       begin
           temp:='-1';
           Break;
       end;

   end;
 y:=temp;

end;

begin
readln(s1);
readln(s2);

writeln(y(s1,s2));

readln;
end.

const   fi='';
var
        x,y,z:string;

procedure solve;
var i,n,t:int32;
begin
        randomize;
        n:= length(x);
        for i:= 1 to n do
        begin
                if x[i]<z[i] then
                begin
                        write(-1); exit;
                end;
                t:= ord(x[i])+random(122-ord(x[i]));
                if x[i]>z[i] then y:= y+z[i]
                else y:= y+chr(t);
        end;
        write(y);
end;
begin
        assign(input,fi); reset(input);
        readln(x);
        read(z);
        solve;
        close(input);
end.

var
st1,st2,st3:string;
i,sz,usl,per:byte;

begin
readln(st1);
readln(st2);
sz:=length(st1);
usl:=0;
st3:='';
 for i:=1 to sz do
  if st2[i]>st1[i] then inc(usl);

if usl>0 then write(-1) else
 begin
 for i:=1 to sz do
   begin
   if st1[i]>st2[i] then
     st3:=st3+st2[i];

   if st1[i]=st2[i] then
     begin
     per:=ord(st1[i]);
      if per=122 then st3:=st3+chr(per) else
       begin
        inc(per);
        st3:=st3+chr(per);
       end;
     per:=0;
    end;
    end;
    end;
  write(st3);
  end.

program ideone;

var x,z:string; i:integer; zz:boolean;
begin
readln(x);
readln(z);
zz:=true;
while (i<=length(x)) AND (zz=true) do
	begin
	if ord(z[i])>ord(x[i]) then zz:=false;
	inc(i);
	end;
if zz=false then writeln('-1')
else writeln(z);
end.

var s1,s2,s3:string;
    n,i:longint;
begin
//assign(input,'b.inp');reset(input);
//assign(output,'b.out');rewrite(output);
readln(s1);
readln(s3);
n:=length(S1);
for i:=1 to n do s2:=s2+'+';
For i:=1 to n do
    begin
        if s3[i]=s1[i] then
                begin
                      s2[i]:='z';
                      continue;
                end;
        if s3[i]>s1[i] then
                begin
                     writeln(-1);
                     halt;
                end;
        s2[i]:=s3[i];
    end;
writeln(s2);
end.

var x,y:ansistring; i:longint;
begin
  readln(x); readln(y);
  for i:=1 to length(x) do
    if x[i]<y[i] then
    begin write(-1); halt end;
  write(y)
end.

var
 s1,s3:ansistring;
 i:longint;
begin
 readln(s1);
 readln(s3);
 for i:=1 to length(s1) do
  if s1[i]<s3[i] then
   begin
    write(-1);
    halt;
   end;
 write(s3);
end.

uses math;
const inp='key.inp'; out='key.out';

var   x,y,res:ansistring;

procedure main; var i:longint; begin
    //assign(input,inp);assign(output,out);reset(input);rewrite(output);
    readln(x); readln(y);
    i:=1;
    while i<=length(x) do begin
        if (min(ord(x[i]),ord(y[i]))=ord(x[i]))and(x[i]<>y[i]) then begin
            writeln('-1'); halt;
        end else inc(i);
    end;
    i:=1; res:='';
    while i<=length(x) do begin
        if min(ord(x[i]),ord(y[i]))=ord(y[i]) then res:=res+y[i]
        else res:=res+x[i];
        inc(i);
    end;
    writeln(res);
end;

begin
    main;
end.

var a,b,c,d,i,z:integer;
a1,a2,a3,a4:string;
begin
readln(a1);
readln(a2);
c:=length(A1);
for i:=1 to c do begin
if a2[i]>A1[i] then begin
writeln(-1);
z:=1;
break;
end;
end;
if z=0 then begin
a3:=a2;
writeln(A3);
end;
end.

var i:longint;
    a,b,c:string;
begin
readln(a);readln(c);
for i:=1 to length(a) do if a[i]<c[i] then begin writeln(-1);halt;end else b:=b+c[i];
writeln(b);
end.

var n,m,i,j:longint;
    a,b,c:string;
begin
readln(a);readln(c);
for i:=1 to length(a) do begin
  if a[i]<c[i] then begin writeln(-1);halt;end;
  if a[i]=c[i] then b:=b+a[i];
  if a[i]>c[i] then b:=b+c[i];
end;
writeln(b);
end.

var	s,t:string;
	i:integer;
	bool:boolean;
begin
	readln(s);
	readln(t);
	bool:=false;
	for i:=1 to length(s) do
		if t[i]>s[i] then
		begin
			bool:=true;
			break;
		end;
	if bool=false then writeln(t) else writeln(-1);
end.

Var
    s1, s2, s3: String;

Begin
    Readln(s1);
    Readln(s2);
    For Var i := 1 to Length(s1) do
        If s2[i] > s1[i] then Begin
            Write(-1);
            Exit
        End
        Else If s1[i] = s2[i] then
            s3 += s1[i]
        Else
            s3 += s2[i];
    Write(s3)
End.

var  s,s1: ansistring;
i,j,l: longint;
b: boolean;

begin
readln(s);
readln(s1);
l:=length(s);
for i:=1 to l do
  if s1[i]>s[i] then b:=true;
if b=true then write(-1) else write(s1);
readln;
end.

var
  s1, s2, s3, s5: string;
  i, j, k: integer;

begin
  readln(s1);
  readln(s2);
  for i := 1 to length(s1) do
  begin
    if s1[i] = s2[i] then
      s3 := s3 + 'z';
    if s1[i] > s2[i] then
      s3 := s3 + s2[i];
    if s1[i] < s2[i] then begin
      writeln('-1');
      exit();
    end;
  end;
  writeln(s3);

end.

   const nn=600000; nnn=2000;eps=0.00000001;  besk1=200000008;
   label 1,2;
    type   { real=double;}  {string=ansistring;}
    mas=array [0..nn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[-100000..nn] of int64;mass1=^mass;
    var ot,qq,pos,t,l,nm,n,s1,s2,m,s,imax,smin,cen,dl,t2,i1,p,prost,besk:int64;
    k,step,ii,i,j:longint;
     oot,yt,yyot,aaa,bbb,ccc:extended;
     sss:array[-10..100000] of char;
     sssnew:array[-10..100000] of char;
     x,y,dd,dist,a,b:array[-100000..2000000] of int64;
     dda,ddb:array[-10..1200,-10..1200] of int64;
     ss1,ss2:string;
    ss:string;ch:char;
    zan:array[-100..2000000] of boolean;
    maxpr:array[0..nn] of string;
    st2:array[0..nnn] of string;
     v0,v1,s0,t0:real;
     zv:point;
     zz,aa,bb,cc,sumsq,sq,xx,yy:array[-100000..nn] of extended;
     xm,ym,yot:extended;
       flag,flag1:boolean;
    function al(x,y:extended):extended; var t0,t1,p,s0,s1:extended;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p/pi*180;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

  function evkl(a,b:int64):zap1; var d,x,y,r,q,i,j,k,x1,x2,y1,y2:int64;
  tt:zap; tt1:zap1;
begin
  if a<b then begin r:=a;a:=b;b:=r; end;
  x2:=1;x1:=0;y2:=0;y1:=1;
  while b>0 do
    begin q:=a div b; r:=a mod b; x:=x2-q*x1;y:=y2-q*y1;
          a:=b;b:=r;x2:=x1;x1:=x;y2:=y1;y1:=y;

    end;
    d:=a; x:=x2;y:=y2; tt.p1:=d;tt.p2:=x;tt.p3:=y; tt1:=@tt;
   evkl:=tt1;
end;

 function col(ss1:string):int64;
var n,i,j,ot:longint;
 begin
    n:=length(ss1);    ot:=0;
    for i:=1 to n-1 do if (ss1[i]='V')and(ss1[i+1]='K')
    then inc(ot);
     col:=ot;
 end;

begin
  {  assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
   }
    readln(ss1);n:=length(ss1);
    readln(ss2);n:=length(ss1);

    flag:=true;
    for i:=1 to n do if ss1[i]<ss2[i] then flag:=false;
    if not flag then begin writeln(-1); goto 1; end;
    writeln(ss2);

   1:          close(output);
end.

program VALUED_KEYS;
const fi='';
      fo='';
var s1,s2:string;

procedure nhap;
var f:text;
begin
 assign(f,fi);
 reset(f);
  readln(f,s1);
  readln(f,s2);
 close(f);
end;

procedure xuat(kq:string);
var g:text;
begin
 assign(g,fo);
 rewrite(g);
  writeln(g,kq);
 close(g);
 halt;
end;

procedure xuli;
var i:byte;
    kq:string;
begin
 kq:='';
 for i:=1 to length(s1) do
        if s2[i]>s1[i] then xuat('-1')
        else
                if s2[i]<s1[i] then kq:=kq+s2[i]
                else kq:=kq+'z';
 xuat(kq);
end;

BEGIN
 nhap;
 xuli;
END.

const
fi='';
fo='';
var
x,y:string;
//free:array[1..100] of boolean;
procedure enter;
var f:text;
i:longint;
begin
    assign(f,fi);
    reset(f);
    readln(f,x);
    readln(f,y);
    close(f);
end;
function min(a,b:char):char;
begin
    if a>b then min:=b else min:=a;
end;
procedure solve;
var f:text;
z:string;
kq:char;
k,i:longint;
begin
    assign(f,fo);
    rewrite(f);
    z:='';
    k:=length(x);
    for i:=1 to k do
     begin
         if x[i]<y[i] then
          begin
              write(f,'-1');
              close(f);
              exit;
          end;
         kq:=min(x[i],y[i]);
        if kq<>'z' then
         if kq=x[i] then kq:=chr(ord(x[i])+1);
         z:=z+kq;
     end;
     write(f,z);
     close(f);
end;
begin
    enter;
    solve;
end.

var s1,s2,a:ansistring; n,i:longint;  check:boolean;
begin
	//assign(input,'c2.inp'); reset(input);
	//assign(output,'c2.out'); rewrite(output);
	readln(s1);
	readln(s2);
	n:=length(s1);
	for i:=1 to n do
	begin
                randomize;
                if ord(s1[i])=ord(s2[i]) then a:=a+chr(random(122-ord(s1[i]))+ord(s1[i]))
		else
			if ord(s1[i])>ord(s2[i]) then a:=a+s2[i]
			else a:=a+chr(123);
	end;
	check:=false;
	for i:=1 to n do
		if (ord(a[i])>122) then check:=true;
	if check then write(-1) else write(a);
end.

var
x,z,y:string;
i,n,k:longint;
check:boolean;
begin
readln(x);
readln(y);
n:=1;

check:=false;
for i:=1 to length(x) do begin
  if ord(x[i]) < ord(y[i]) then begin
    check:=true;
    break;
    end
  else z:= z + y[i];
end;
if check then writeln(-1) else writeln(z);
end.

var
x,z,y:string;
i,n,k:longint;
check:boolean;
begin
readln(x);
readln(y);
n:=1;

check:=false;
 if length(x) = 1 then writeln(y) else
begin
for i:=1 to length(x) do begin
    if ((2*i-1) <= length(x) ) then
  if (x[2*i-1] <> y[2*i-1]) then check:=true;
  if check then break;
end;
if check then writeln(-1) else writeln(y);
end;
end.

program vk;
var a,b,c:string;
    i:byte;
    flag:boolean;
begin
   readln(a);
   read(c);
   flag:=true;
   for i:= 1 to length(a) do
   begin
      if i mod 2=1 then
      begin
         if a[i]<> c[i] then
         begin
            flag:=false;
            break;
         end;
      end;
   end;
   if flag then
   begin
      write(c);
   end
   else
   begin
      write(-1);
   end;
end.

var a,s,d,f : integer;
z,x,c,v: string;
begin
  readln (z);
  read (x);

    for a:=1 to length(x) do
    if ord(x[a])>ord(z[a]) then begin
                                  write (-1);
                                  exit;
                                end;

                                for a:=1 to length(x) do
                                if x[a]=z[a] then write (chr(ord(x[a])+1)) else
                                 write (x[a]);

end.

Var
    s1, s2: String;

Begin
    Readln(s1);
    Readln(s2);
    For Var i := 1 to Length(s1) do
        If s2[i] > s1[i] then Begin
            Write(-1);
            Exit
        End
        Else If s1[i] = s2[i] then
            Write(s1[i])
        Else
            Write(s2[i])
End.

var s:string;
    i,rez,f:longint;
begin
    readln(s);
    s:=' '+s+' ';
    for i:=2 to length(s)-1 do
        begin
            if (s[i]='K')and(s[i-1]='V') then
                inc(rez);
        end;

    for i:=3 to length(s) do if (s[i]='V')and(s[i-1]='V')and(s[i-2]='V') then f:=1;
    for i:=3 to length(s) do if (s[i]='V')and(s[i-1]='V')and(s[i-2]='V') then f:=1;
    if (s[2]=s[3])and(s[2] = 'K') then f:=1;
    if (s[length(s)-1]=s[length(s)-2])and(s[length(s)-2] = 'V') then f:=1;
    writeln(rez+f);
end.

var
  x, z, y: string;
  n, i, k, l: integer;

begin
  readln(x);
  readln(z);
  for i := 1 to length(x) do
  begin
    if (ord(x[i]) > ord(z[i])) then
      y := y + z[i];
    if (ord(x[i]) = ord(z[i])) then
      y := y + chr(ord(z[i]) + 1);
    if (ord(x[i]) < ord(z[i])) then
    begin
      y := '-1';
      break;
    end;
  end;
  writeln(y);
end.

program HelloWorld;
var x,y,z:string;
    ch:char;
    i,l,test,a:integer;
begin
readln(x);
readln(z);
{x:='ab';
z:='ba';}
y:=x;
test:=1;
l:=length(x);
for i:=1 to l do
begin
if (x[i]=z[i]) then
begin
a:=ord(x[i]);
a:=a+1;
ch:=chr(a);
y[i]:=ch;
{writeln(ord(x[i]));
writeln(a);
writeln(ch);}
end
else
begin
        if (x[i]>z[i]) then
        y[i]:=z[i]
        else
        begin
        writeln('-1');
        test:=0;
        end;
        end;

    end;
    if test=1 then
    writeln(y);
end.

program HelloWorld;
var x,y,z:string;
    ch:char;
    i,l,test,a:integer;
begin
readln(x);
readln(z);
{x:='ab';
z:='ba';}
y:=x;
test:=1;
l:=length(x);
for i:=1 to l do
begin
if (x[i]=z[i]) then
begin
a:=ord(x[i]);
a:=a+1;
ch:=chr(a);
y[i]:=ch;
{writeln(ord(x[i]));
writeln(a);
writeln(ch);}
end
else
begin
        if (x[i]>z[i]) then
        y[i]:=z[i]
        else
        begin
        writeln('-1');
        break;
        test:=0;
        end;
        end;

    end;
    if test=1 then
    writeln(y);
end.

program HelloWorld;
var x,y,z:string;
    ch:char;
    i,l,test,a:integer;
begin
readln(x);
readln(z);
{x:='ab';
z:='ba';}
y:=x;
test:=1;
l:=length(x);
for i:=1 to l do
begin
if (x[i]=z[i]) then
begin
a:=ord(x[i]);
a:=a+1;
ch:=chr(a);
y[i]:=ch;
{writeln(ord(x[i]));
writeln(a);
writeln(ch);}
end
else
begin
        if (x[i]>z[i]) then
        y[i]:=z[i]
        else
        begin
        writeln('-1');
        test:=0;
        break;
        end;
        end;

    end;
    if test=1 then
    writeln(y);
end.

//fpc 3.0.0

program HelloWorld;
var x,y,z:string;
    ch:char;
    i,l,test,a:integer;
begin
readln(x);
readln(z);
{x:='ab';
z:='aa';}
y:=x;
test:=1;
l:=length(x);
for i:=1 to l do
begin
if (x[i]=z[i]) then
begin
a:=ord(x[i]);
a:=a+1;
ch:=chr(a);
y[i]:=ch;
{writeln(ord(x[i]));
writeln(a);
writeln(ch);}
end
else
begin
        if (x[i]>z[i]) then
        y[i]:=z[i]
        else
        begin
        y:=('-1');
        test:=0;
        end;
        end;

    end;

    writeln(y);
end.

program HelloWorld;
var x,y,z:string;
    ch:char;
    i,l,test,a:integer;
begin
readln(x);
readln(z);
{x:='ab';
z:='ba';}
y:=x;
test:=1;
test:=0;
l:=length(x);
for i:=1 to l do
begin
if (x[i]=z[i]) then
begin
a:=ord(x[i]);
a:=a+1;
ch:=chr(a);
y[i]:=ch;
{writeln(ord(x[i]));
writeln(a);
writeln(ch);}
end
else
begin
        if (x[i]>z[i]) then
        y[i]:=z[i]
        else
        begin
        writeln('-1');
        test:=0;
        end;
        end;

    end;
    if test=1 then
    writeln(y);
end.

var a,b:string;
c:array[1..255]of char;
i:longint;
begin
//(input,'yjzdys.in');reset(input);
//assign(output,'yjzdys.out');rewrite(output);
readln(a);
readln(b);
for i:=1 to length(a) do
  if a[i]<>b[i] then
    c[i]:=b[i]
  else
    c[i]:='z';
for i:=1 to length(a) do
  write(c[i]);
close(input);
close(output);
end.

var x,y:string;
i:longint;
a:array[1..100]of char;
begin
//assign(input,'yjzdys.in');reset(input);
//assign(output,'yjzdys.out');rewrite(output);
readln(x);
readln(y);
if x<y then writeln('-1')
else
  begin
  for i:=1 to length(y) do
    if x[i]<>y[i] then  a[i]:=y[i]
    else
      begin
      if y[i]<>'z' then a[i]:=succ(y[i])
      else a[i]:=pred(y[i]);
      end;
  for i:=1 to length(y) do write(a[i]);
  end;
close(input);close(output);
end.

var
  a,b,i,n,k,j,m,p:longint;
  t,s,x:string;
  was:array[1..111111]of boolean;
begin
  readln(s);
  readln(t);

  for i:=1 to length(s) do
  begin
    if ((s[i]=t[i]) and (s[i]='z')) or (s[i]<t[i]) then begin writeln(-1);halt;end;
    if (s[i]=t[i]) then x:=x+chr(ord(s[i])+1) else
    if t[i]>s[i] then x:=x+s[i] else x:=x+t[i];
  end;

  writeln(x);
end.

uses math;
const
	fi = '';
	fo = '';
	maxn = 100001;
var x,y,z:string; i,j,n:longint;
	f1,f2:text;
begin
	assign(f1,fi); reset(f1);
	assign(f2,fo); rewrite(f2);
	readln(f1,x);
	readln(f1,y);
	n:=length(x);
	for i:=1 to n do
	begin
		if x[i]=y[i] then z:=z+'z'
		else z:=z+y[i];
	end;
	writeln(f2,z);
	close(f1); close(f2);
end.

var
x,y,z:string;
a:char;
i,j,k:longint;
begin
readln(x);
readln(y);
z:='';
for i:=1 to length(x) do begin
 if (y[i]<x[i]) then begin
  z:= z + y[i];
  end
 else if (y[i]>x[i]) then begin
  writeln('-1');
  exit;
 end
 else if (y[i]=x[i]) then begin
  z:= z + chr(ord(y[i])+1);
  end;
end;

write(z);
writeln;
end.

var
 x,y,z :string;
 i : longint;

begin
	readln(x);
	readln(y);
	z:='';
	for i:= 1 to length(x) do begin
		z:=z+' ';
		if(x[i]<y[i])then begin
			writeln(-1);
			exit;
		end
		else if(x[i]>y[i])then begin
			z[i]:=y[i];
		end
		else begin
			z[i]:=chr(ord(x[i])+1);
		end;
	end;
	writeln(z);
end.

var
 x,y,z :string;
 i : longint;

begin
	readln(x);
	readln(y);
	z:='';
	for i:= 1 to length(x) do begin
		z:=z+' ';
		if(x[i]<y[i])then begin
			writeln(-1);
			exit;
		end
		else if(x[i]>y[i])then begin
			z[i]:=y[i];
		end
		else begin
			z[i]:=chr(ord(x[i])+1);
		end;
		if(z[i]<'a')or(z[i]>'z')then begin
			writeln(-1);
			exit;
		end;
	end;
	writeln(z);
end.

var x,z,y:string;
a,b,c,i:integer;
begin

  readln(x);
  readln(z);
  y:='';
  for i:=1 to length(x) do begin
    a:=ord(x[i]); b:=ord(z[i]);
    if a=b then c:=a+1;
    if a>b then c:=b;
    if a<b then c:=-1;
    if (c<ord('a'))or(c>ord('z')) then begin
      y:='-1';
      break;
      end else y:=y+chr(c);

  end;
  writeln(y);

end.

const inp='key.inp'; out='key.out';

var   x,y,res:ansistring;

procedure main; var i:longint; begin
    //assign(input,inp);assign(output,out);reset(input);rewrite(output);
    readln(x); readln(y);
    i:=1;
    while i<=length(x) do begin
        if x[i]<>y[i] then begin
            writeln('-1'); halt;
        end else inc(i,2);
    end;
    i:=1; res:='';
    while i<=length(x) do begin
        if i mod 2 <> 0 then res:=res+'y'
        else res:=res+y[i];
        inc(i);
    end;
    writeln(res);
end;

begin
    main;
end.

const
fi='';
fo='';
var
x,y:string;
//free:array[1..100] of boolean;
procedure enter;
var f:text;
i:longint;
begin
    assign(f,fi);
    reset(f);
    readln(f,x);
    readln(f,y);
    close(f);
end;
function min(a,b:char):char;
begin
    if a>b then min:=b else min:=a;
end;
procedure solve;
var f:text;
z:string;
kq:char;
k,i:longint;
begin
    assign(f,fo);
    rewrite(f);
    z:='';
    k:=length(x);
    for i:=1 to k do
     begin
         if x[i]<y[i] then
          begin
              write(f,'-1');
              close(f);
              exit;
          end;
         kq:=min(x[i],y[i]);
         if kq=x[i] then kq:=chr(ord(x[i])+1);
         z:=z+kq;
     end;
     write(f,z);
     close(f);
end;
begin
    enter;
    solve;
end.

var s1,s2,a:string; n,i:longint;  check:boolean;
begin
	//assign(input,'c2.inp'); reset(input);
	//assign(output,'c2.out'); rewrite(output);
	readln(s1);
	readln(s2);
	n:=length(s1);
	for i:=1 to n do
	begin
		if s1[i]=s2[i] then a:=a+chr(ord(s1[i])+1)
		else
			if s1[i]>s2[i] then a:=a+s2[i]
			else a:=a+chr(123);
	end;
	check:=false;
	for i:=1 to n do
		if (ord(a[i])<97) or (ord(a[i])>122) then check:=true;
	if check then write(-1) else write(a);
end.

var s1,s2,a:string; n,i:longint;  check:boolean;
begin
	//assign(input,'c2.inp'); reset(input);
	//assign(output,'c2.out'); rewrite(output);
	readln(s1);
	readln(s2);
	n:=length(s1);
	for i:=1 to n do
	begin
		if ord(s1[i])=ord(s2[i]) then a:=a+chr(ord(s1[i])+1)
		else
			if ord(s1[i])>ord(s2[i]) then a:=a+s2[i]
			else a:=a+chr(123);
	end;
	check:=false;
	for i:=1 to n do
		if (ord(a[i])>122) then check:=true;
	if check then write(-1) else write(a);
end.

var s1,s2,a:string; n,i:longint;  check:boolean;
begin
	//assign(input,'c2.inp'); reset(input);
	//assign(output,'c2.out'); rewrite(output);
	readln(s1);
	readln(s2);
	n:=length(s1);
	for i:=1 to n do
	begin
		if ord(s1[i])=ord(s2[i]) then a:=a+chr(ord(s1[i])+1)
		else
			if ord(s1[i])>ord(s2[i]) then a:=a+s2[i]
			else a:=a+chr(123);
	end;
	check:=false;
	for i:=1 to n do
		if (ord(a[i])>122) then check:=true;
        if s2=a then check:=true;
	if check then write(-1) else write(a);
end.

var
x,z,y:string;
i,n,k:longint;
check:boolean;
begin
readln(x);
readln(y);
n:=1;

check:=false;
for i:=1 to length(x) do begin
  if (x[2*n-1] <> y[2*n-1]) then check:=true;
  if check then break;
   if ((2*i) <=length(x)) and ((2*i-1) <= length(x)) then
      z:=z+x[2*i-1]+y[2*i];
   if (2*i <= length(x)) and ( (2*i-1) > length(x)) then
      z:=z+y[2*i];
   if (2*i > length(x)) and ( (2*i-1) <=length(x)) then
      z:=z+x[2*i-1];
end;
if check then writeln(-1) else writeln(z);
end.