object Main extends App {
  def getGcd(a: Int, b: Int): Int = {
    (1 to math.min(a, b))
      .find(e => e != 1 && a % e == 0 && b % e == 0)
      .map(common => common * getGcd(a / common, b / common))
      .getOrElse(1)
  }
  Stream
    .continually(readLine)
    .takeWhile(_ != null)
    .map(_.split(" ").map(_.toInt))
    .map {
      case Array(a, b) =>
        val gcd: Int = getGcd(a, b)
        Seq(gcd, math.max(a, b) / gcd * math.min(a, b)).mkString(" ")
    }
    .foreach(println)
}

