Const
n=10;var
a:array[1..n]of integer;
i,max1,max2,im1,im2:integer;
begin for i:=1 to n do
begin
a[i]:=random(21)-10;
write(a[i]:4);
end;
max1:=a[1];im1:=1;
for i:=1 to n do
if a[i]>max1 then
begin
max1:=a[i];
im1:=i;
end;
for i:=1 to n do
if (a[i]<=max1)and(i<>im1)and(a[i]>max2)then
begin
max2:=a[i];
im2:=i;
end;
writeln;
writeln('i: ',im1,' max1: ', max1,' i: ',im2,' max2: ',max2);
end.