var arr:array[1..1000000]of integer;
        max,m1,m2,m3,n:longint;
        i,j,h:longint;
procedure swap (a,b,c,d:integer);
begin
        max:=a;
        m1:=b;
        m2:=c;
        m3:=d;
end;

label continuing;

BEGIN
max:=-MaxLongInt;
read(n);
for i:=1 to n do
        read(arr[i]);

{write(arr[1],arr[2],arr[3]);}

for i:=1 to n do

  for j:=i to n do

    for h:=j to n do

      begin

      if (i=j) or (i=h) or (j=h) then goto continuing;

      {writeln(i,' ',j,' ',h);}

      if arr[i] * arr[j] * arr[h]  >  max  then

                swap(arr[i]*arr[j]*arr[h],i,j,h);

      continuing:
      end;

{write(m1,m2,m3);}
writeln(arr[m1],' ',arr[m2],' ',arr[m3]);

readln;

END.
