Const n=10;
Var a:array[1..n] of integer;
i,k,j:integer;
Begin
Randomize;
For i:=1 to n do
Begin
A[i]:=Random(10);
Write(a[i],' ');
end;
Writeln;
For i:=1 to n do
Begin
If a[i] mod 3=0 then
Write(a[i],' ');
end;
for i:=1 to n-1 do
for j:=1 to n-i do
begin
if (a[j] > a[j+1]) then
begin
k:= a[j];
a[j] := a[j+1];
a[j+1] := k;
end;
end;
writeln;
for i:=1 to n do
write(a[i],' ');
readln;
end.