var
a: array[1..50] of integer;
i,n,max,r: integer;
Begin
randomize;
readln(n);
for i:=1 to n do
begin
a[i]:=random(50)-25;
write(a[i]:4);
end;
writeln;
max:=1;
for i:=1 to n do
if a[i]>a[max] then max:=i;
r:=a[1];
a[1]:=a[max];
a[max]:=r;
for i:=1 to n do write(a[i]:4);
readln
End.