program max3;
var a:array [1..10000] of integer;
    max1,max2,max4,n,m,i:integer;
begin
readln(n);
for i:=1 to n do
read(a[i]);
max1:=-30001;
max2:=-30001;
max4:=-30001;
for i:=1 to n do
if a[i]>max1 then begin
max1:=a[i]; m:=i;
end;
a[m]:=-30001;
for i:=1 to n do
if a[i]>max2 then begin
max2:=a[i]; m:=i;
end;
a[m]:=-30001;
for i:=1 to n do
if a[i]>max4 then begin
max4:=a[i]; m:=i;
end;
a[m]:=-30001;
writeln(max1,' ',max2,' ',max4);
end.