const
N = 100;
var
A : array [1..N] of integer;
I, J : integer;
procedure BubbleSort;
var
T: Integer;
begin
for I := N downto 1 do
for J := 1 to N-1 do
if A[J] > A[J + 1] then
begin
T := A[J];
A[J] := A[J + 1];
A[J + 1] := T;
end;
end;
begin
Randomize;
for I := 1 to N do A[I] := random(N);
for I := 1 to N do write(A[I],' ');
writeln;
BubbleSort;
for I := 1 to N do write(A[I],' ');
end.