var a,aa:string;
b,i,v,vv:integer;
label 1,2,3,4,5,6;
begin
readln(a);
b:=length(a);
aa:='';
for i:=b downto 1 do
begin
aa:=aa+a[i];
end;
i:=0;v:=0;
3:i:=i+1;
if i>b then goto 4;
vv:=i;
if aa[i]=' ' then
begin
1:write(aa[vv-1]);
vv:=vv-1;
if vv-1=v then goto 2
else goto 1;
end;
goto 3;
2:v:=i;
write(' ');
goto 3;
4:i:=i-1;
6:write(aa[i]);
i:=i-1;
if i=v then goto 5
else goto 6;
5:end.