var m,a,b,c,x,y,z,p:integer;
    n:array[1..1000000] of integer;
    s:array[1..999998,2..999999,3..1000000] of integer;

begin
     read(m);
     for a:=1 to m do read(n[a]);
     for a:=1 to m-2 do
         for b:=a+1 to m-1 do
             for c:=b+1 to m do s[a,b,c]:=n[a]*n[b]*n[c];
     p:=s[1,2,3];
     for a:=1 to m-2 do
         for b:=a+1 to m-1 do
             for c:=b+1 to m do if s[a,b,c]>p then begin
                                                      p:=s[a,b,c];
                                                      x:=n[a];
                                                      y:=n[b];
                                                      z:=n[c];
                                                 end;
     writeln(x,' ',y,' ',z);
end.