Program enot;
Var a: array [1..5] of integer;
i,min,max,b,j,g,h,f,c:integer;
begin
for i:= 1 to 5 do read (a[i]);
min:=a[1];
for i:= 2 to 5 do
if a[i] begin
min:= a[i];
j:= i;
end;
max:= a[1];
for i:= 2 to 5 do
if a[i]>max then
begin
max:= a[i];
h:=i;
end;
f:=a[j];
a[j]:=a[1];
a[1]:=f;
g:= a[h];
a[h]:=a[5];
a[5]:= g;
for i:= 1 to 5 do
write(a[i]:4);
end.