Var a:array[1..10000]of longint;
    n,i,j,m1,m2,m3,i1,i2,i3:LongInt;
Begin
  readln(n);
      for i:=1 to n do read(a[i]);
  i1:=a[1];
  i2:=a[2];
  i3:=a[3];
  for m1:=1 to n do
   for m2:=1 to n do
    for m3:=1 to n do
     if (a[m1]*a[m2]*a[m3]>a[i1]*a[i2]*a[i3])
     and(m1<>m2)and(m1<>m3)and(m2<>m3)then begin
                                             i1:=m1;
                                             i2:=m2;
                                             i3:=m3;
                                           end;
  if n=3 then writeln(a[1],' ',a[2],' ',a[3])
         else writeln(a[i1],' ',a[i2],' ',a[i3]);
End.
















