Begin readln(n, a[1],); max1:=a[1]; max2:=a[1]; for I:=2 to n do begin readln(a[i]); if a[i] > max1 then begin max1:=a[i]; t:=i; end; if a[i]max2 thenbegin max2:=a[i]; k:=i; end; writeln(t,' ',max1); writeln(k,' ',max2); s:=max1+max2; writeln(s) end.
readln(n, a[1],);
max1:=a[1];
max2:=a[1];
for I:=2 to n do begin
readln(a[i]);
if a[i] > max1 then begin
max1:=a[i];
t:=i;
end;
if a[i]max2 thenbegin
max2:=a[i];
k:=i;
end;
writeln(t,' ',max1);
writeln(k,' ',max2);
s:=max1+max2;
writeln(s)
end.