procedure Upor(k:integer;D:mat;var D1:mat);
var i,j:integer;
j1:real;
begin
for i:=1 to k do
for j:= 1 to k do
If D[i,j]>D[i,j+1] then
begin
j1:= D[i,j];
D[i,j]:=D[i,j+1];
D[i,j+1]:=j1;
end;
for i:=1 to k do
for j:= 1 to k do
D1[i,j]:=D[i,j];
end;
procedure Upor(k:integer;D:mat;var D1:mat);
var i,j:integer;
j1:real;
begin
for i:=1 to k do
for j:= 1 to k do
If D[i,j]>D[i,j+1] then
begin
j1:= D[i,j];
D[i,j]:=D[i,j+1];
D[i,j+1]:=j1;
end;
for i:=1 to k do
for j:= 1 to k do
D1[i,j]:=D[i,j];
end;