var i,j,max,min,imax,imin:integer; A:array[0..5,0..3] of integer;
begin
min:=101;
Randomize;
for i:=0 to 5 do begin
for j:=0 to 3 do begin
A[i,j]:= random(100);
write(A[i,j]:3);
end;writeln;
end;
writeln;writeln;
for i:=0 to 5 do begin
for j:=0 to 3 do begin
if A[i,j] > max then begin max:= A[i,j];imax:=j;end;
if A[i,j] < min then begin min:= A[i,j];imin:=j;end;
end;
A[i,imin]:=max;
A[i,imax]:=min;
max:=0;min:=101;
imin:=0;imax:=0;
end;
writeln;
for i:=0 to 5 do begin
for j:=0 to 3 do begin
write(A[i,j]:3);
end;writeln;
end;
end.