uses crt;
var s1,s2:string;
i,j,d1,d2:integer;
begin
clrscr;
readln(s1,s2);
d1:=length(s1);
d2:=length(s2);
for i:=1 to d1 do
if not(s1[i] in ['0'..'9']) then delete(s1,i,1);
for i:=1 to d2 do
if not(s2[i] in ['0'..'9']) then delete(s2,i,1);
writeln(s1);
writeln(s2);
writeln(s1+s2);
readln;
end.