var Matrix: array[1..7, 1..7] of Byte;
procedure FillPerimeter(Offset, Side, Accumulator: integer);
var Index: integer;
procedure Put(Row, Column: integer);
begin
Matrix[Row, Column]:=Accumulator;
Inc(Accumulator);
end;
begin
for Index:=1 to Side do Put(Offset, Index+Offset-1);
for Index:=1 to Side-1 do Put(Index+Offset, Offset+Side-1);
for Index:=Side-1 downto 1 do Put(Offset+Side-1, Index+Offset-1);
for Index:=Side-1 downto 2 do Put(Index+Offset-1, Offset);
if Side>1 then FillPerimeter(Offset+1, Side-2, Accumulator);
end;
begin
FillPerimeter(1, 7, 1);
Yield(Matrix);
end.