let rec gcd x y =
  if y = 0L then x
  else gcd y (Int64.rem x y)

let _ =
  try
    while true do
      let x, y = Scanf.scanf "%Ld %Ld\n" (fun x y -> (x,y)) in
      let g = gcd x y in
      Printf.printf "%Ld %Ld\n" g (Int64.mul (Int64.div x g) y)
    done
  with
    End_of_file -> ()