Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan() {
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, y)
	}

}

func nextInts() (a, b int) {
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

func gcd(x, y int) int {
	if x < y {
		gcd(y, x)
	}
	for 0 < y {
		r := x % y
		x, y = y, r
	}
	return x
}

func lcm(x, y int) int {
	return (x * y) / gcd(x, y)
}

Python: # Vol0005.
import sys


def intinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def get_gcd(x, y):
    if x < y: return get_gcd(y, x)
    # x >= yのときはx % yを計算してyとx % yの話にする。
    # ここでx % yのところが0ならばyが求める答えとなる。
    if y == 0: return x
    return get_gcd(y, x % y)

def main():
    data = []
    lines = sys.stdin.readlines()
    for line in lines:
        data.append(line.split())

    N = len(data)
    for i in range(N):
        a = int(data[i][0]); b = int(data[i][1])
        gcd = get_gcd(a, b)
        lcm = (a // gcd) * b
        print('%d %d' % (a, b))

if __name__ == "__main__":
    main()

Python: import math
def main():
    def get_inputs():
        input_list = []
        try:
            while True:
                input_list.append(input())
        except EOFError:
            return input_list

    input_list = get_inputs()
    lcm = lambda a,b: a*b / math.gcd(a,b)
    for str_num in input_list:
        tmp = str_num.split(" ")
        a,b = int(tmp[0]),int(tmp[1])
        x = math.gcd(a,b)
        y = int(lcm(a,b))
        print("{} {}".format(x,y))
    return None


if __name__ == '__main__':
    main()

Python: def euclidean_algorithm(a,b):
  if a == b: return(a)
  if a >  b: return(euclidean_algorithm(a-b,b))
  if a  < b: return(euclidean_algorithm(b-a,a))

inputs=[]
while True:
  try:
    inputs.append( list( map(int,input().split()) ) )
  except EOFError:
    break

for i in inputs:
  gcd = euclidean_algorithm(i[0],i[1])
  lcm = int(i[0]*i[1]/gcd)
  print("{0} {1}".format(gcd,lcm))

Python: import sys

def dividend(num, Q):
    a = Q
    b = (num / Q) * Q
    Q = num - (num / Q) * Q
    if num  == b:
        aaa(a)
        return
    dividend(a, Q)
    
def aaa(greatest_common_divisor):
    least_common_multiple = num1 * num2 / greatest_common_divisor
    print('%s %s' % (greatest_common_divisor, least_common_multiple))
    return

for input_line in sys.stdin:
    num1 = int(input_line.split(' ')[0])
    num2 = int(input_line.split(' ')[1])
    
    if num1 <= num2:
        dividend(num2, num1)
    elif num1 > num2:
        dividend(num1, num2)

Python: import math

while True:
    try:
        a, b = map(int, input().split())
        print(math.gcd(a, b), int((a * b) / math.gcd(a, b)))
    except:
        break

Python: # Aizu Problem 0006: GCD and LCM
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def gcd(a, b):
    while b != 0:
       t = b
       b = a % b
       a = t
    return a


def lcm(a, b):
    return (a * b) // gcd(a, b)


for line in sys.stdin:
    a, b = [int(_) for _ in line.split()]
    print(gcd(a, b), lcm(a, b))

Python: def gcd(a,b):
	a,b=max(a,b),min(a,b)	
	while b!=0:
		a,b=b,a%b
	return a

def lcm(a,b):
	return a*b//gcd(a,b)


while True:
	try:
		x,y=map(int,input().split())
		print(gcd(x,y),lcm(x,y))

	except EOFError:
		break

Python: import sys
def main():
    tmp = sys.stdin.readline().split(" ")
    print (str(int(tmp[0])))
    print (str(int(tmp[1])))
 
if __name__ == "__main__":
    main()

Python: while 1:
    try:
        a = list(map(int, input().split()))
        a.sort()
        while a[1]%a[0] != 0:
            a[1] %= a[0]
            a.sort()
        print(str(a[0]))
    except:
        break

Python: from math import gcd
from sys import stdin

for line in stdin:
    a,b = [int(i) for i in line.split()]
    g = gcd(a,b)
    print(g,int(a*b/g))

Python: while True:
    try:
        a,b=map(int,input().split())
        y=a*b
        if b>a:
            a,b=b,a
        
        while a%b:
            x=a
            a,b=b,x%b

        print(b,int(y/b))

    except:
        break

Python: from math import gcd
while True:
    try:
        a,b=map(int,input().split())
    except:
        break
    print(gcd(a,b),a//gcd(a,b)*b)

Python: def main():
    gcd = lambda n, m : gcd(m, n % m) if m != 0 else n
    while True:
        try:
            n, m = map(int, input().split())

            g = gcd(n, m)
            l = n * m // g

            print(g, l)
        except:
            break

if __name__ == '__main__':
    main()

Python: import sys
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)
for line in sys.stdin:
    a,b=line.split()
    print(gcd(a,b),lcm(a,b))

Python: from math import gcd
import sys

for line in sys.stdin:
    a, b = list(map(int, line.split()))
    print("{0} {1}".format(gcd(a, b), (a * b) / gcd(a, b)))

Python: import sys


def gcd(n, m):
    while m:
        n, m = m, n % m
    return n


def lcm(x, y):
    return int((x * y) / gcd(x, y))

for line in sys.stdin:
    l = line.replace('\n', '')
    a, b = l.split()
    a = int(a)
    b = int(b)
    print(gcd(a, b), lcm(a, b))

Python: import sys
import math
for line in sys.stdin:
    a, b = map(int, line.split())
    gcdab = math.gcd(a, b)
    print(gcdab, int(a / gcdab * b))

Python: def gcd(x, y):
  if x < y:
    tmp = x
    x = y
    y = tmp
  while True:
    if y == 0:
      break
    x = x % y
    tmp = x
    x = y
    y = tmp

  return x

def lcm(x, y):
  return x * y / gcd(x, y)

while True:
  try:
    a, b = map(int, input().split())
    print(gcd(a, b), int(lcm(a, b)))
  except EOFError:
    break

Python: def GCD(a, b):
    if a % b == 0:
        return b
    else:
        yeah = a % b
        return GCD(b, yeah)


def LCM(a, b, a_b_GCD):
    return int((a * b) / a_b_GCD)

while True:
    a, b = map(int, input().split(' '))
    a, b = max(a, b), min(a, b)

    print(GCD(a, b), LCM(a, b, GCD(a, b)))

Python: def digits(n):
    if n < 10: return 1
    c = 0
    while n > 0:
        c += 1
        n = n // 10

    return c

while 1:
    try:
        inp = input()
    except EOFError:
        break
    else:
        n, m = inp.split(' ')
        n = int(n)
        m = int(m)
        print(digits(n + m))

Python: import math
while True:
    try:
        a,b = map(int,input().split())
        gcd = math.gcd(a,b)
        lcm = a*b /gcd
        print(gcd,int(lcm))
    except EOFError:
        break

Python: # -*-coding:utf-8

import fileinput

def main():
    for line in fileinput.input():
        tokens = list(map(int, line.strip().split()))
        a, b = tokens[0], tokens[1]

        if a < b:
            a, b = b, a

        ansGCD = GreatestCommonDivisor(a, b)
        ansLCM = LeastCommonMultiple(a, b)

        print('{0} {1}'.format(ansGCD, ansLCM))

def GreatestCommonDivisor(a, b):
    while b:
        a, b = b, a%b

    return a

def LeastCommonMultiple(a, b):
    return (a*b) / GreatestCommonDivisor(a, b)


if __name__ == '__main__':
    main()

Python: import sys;import math;print("\n".join(["{} {}".format(math.gcd(a,b), a // math.gcd(a,b) * b) for x in sys.stdin for a, b in [[int(y) for y in x.split()]] ]))

Python: def gcd(a,b):
	while b:
		a, b = b, a%b
	return a

def lcm(a,b):
	return a*b/gcd(a,b)

for i in input():
	a,b = map(int, i.split())
	print("{0} {1}".format(gcd(a,b),lcm(a,b)))

Python: #!/usr/bin/env python3

while(True):
	try:
		a, b=map(int, input().split())
	except EOFError:
		break

	gcd=0
	for i in range(a):
		if(a%i==0 and b%i==0):
			gcd=i
	lcm=a*b/gcd
	print("{0} {1}".format(gcd, lcm))