let inp = open_in "beer.in";;
let n = Scanf.fscanf inp "%d" (fun n -> n);;
close_in inp;;

let bi = ref n;;
let bj = ref n;;
let bk = ref n;;

for i = 1 to n do
  for j = 1 to n/i do
    if n mod (i*j) = 0 then
      let k = n/i/j in
      if i+j+k > !bi + !bj + !bk then (bi := i; bj := j; bk := k)
  done
done;;

let out = open_out "beer.out" in
Printf.fprintf out "%d %d %d" !bi !bj !bk;
close_out out;;

