let rec gcd m n =
  if n = 0 then m else gcd n (m mod n);;

let () =
  let rec read z =
    try let (m,n) = Scanf.scanf "%d %d\n" (fun x y -> (x,y)) in
        let g = gcd m n in
        Printf.printf "%d %d\n" g (m*n/g);
        read z
    with End_of_file -> ()
  in read ();;