import scala.io.StdIn._
import scala.annotation.tailrec

object Main {
    def main(args: Array[String]): Unit = sub(readLine().split(" ").map(_.toInt))
    def digit(a: Int, b: Int): Int = if(b == 0) a else digit(b, a % b)

    @tailrec
    def sub(n: Seq[Int]): Unit = {
        val gcd: Int = digit(n(0), n(1))
        val lcm: Int = (n.map(_.toLong).product / gcd.toLong).toInt
        println(s"$gcd $lcm")
        val next: String = readLine()
        if(next == null) Unit else sub(next.split(" ").map(_.toInt))
    }
}