type
intArr = array[1..10] of integer;
function isPrime(n: integer): boolean;
begin
result := False;
if n < 2 then exit;
var d := 2;
while (d <= n div 2) and (n mod d <> 0) do
d += 1;
result := d > n div 2
end;
var
a, b: intArr;
begin
Print('A:');
for var i := 1 to 10 do
begin
a[i] := i;
Print(a[i])
end;
Write(NewLine, 'B: ');
var j := 0;
for var i := 1 to 10 do
begin
if isPrime(a[i]) then
begin
j += 1;
b[j] := a[i];
Print(b[j])
end
end
end.