Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [100]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			break
		}
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

Python: while True:
  try:
    m,n = map(int, input().split())
  except EOFError:
    break
  LCM = m * n
  if m < n:
    m,n = n,m

  # calculating GCD
  while True:
    if m % n == 0:
      GCD = n
      break
    else:
      m, n = n, m % n

  # calculating LCM
  LCM = LCM // GCD

  print(GCD,LCM)

Python: import sys

# 最大公約数(greatest common divisor)を求める関数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

# 最小公倍数(least common multiple)を求める関数
# //は切り捨て除算
def lcm(a, b):
    return a * b // gcd(a, b)

lines = sys.stdin.readlines()
for line in lines:
    a = list(map(int, line.split(" ")))
    print(gcd(a[0], a[1]), lcm(a[0], a[1]))

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

Python: import sys
 
nums = []
 
 
for line in sys.stdin:
    nums.append(line)
 
for i in range(len(nums)):
    input_line = nums[i].split(" ")
    a = int(input_line[0])
    b = int(input_line[1])
 
    if a > b:
        num_bigger = a
        num_smaller = b
    else:
        num_bigger = b
        num_smaller = a

    r = 1   #?????????
    while r > 0:
        r = num_bigger % num_smaller
        num_bigger = num_smaller
        num_smaller = r

    max_common_div = num_bigger
    min_common_mpl = int((a * b)/max_common_div)
 
    print(str(max_common_div) + " " + str(min_common_mpl))

Python: def get_input():
    while True:
        try:
            yield "".join(input())
        
        except EOFError:
            break
            
def calcGCD(a,b):#?????§??¬?´???°????±?????????????????????????????????????????????¨?????????
    if a>b:
        large = a
        small = b
    elif a<b:
        large = b
        small = a
    else:
        return a
        
    
    while True:
        
        if large == small:
            return large
        
        temp_small = large - small
        
        if temp_small < small:
            large = small
            small = temp_small 
        else:
            large = temp_small
            small = small

def calcLCM(a,b,gcd):#????°???¬?????°????±??????????
    lcm = a*b/gcd
    
    return lcm
    


if __name__  == "__main__":
    array = list(get_input())
    for i in range(len(array)):
    
        temp_a,temp_b = array[i].split()
    
        a,b = int(temp_a),int(temp_b)
    
        gcd = calcGCD(a,b)
        lcm = calcLCM(a,b,gcd)
        lcm = int(lcm)
        
        print("{} {}".format(gcd,lcm))

Python: def f(x, y):
    if x % y == 0:
        return y
    return f(y, x % y)
a = []
while True:
    try:
        a.append(list(map(int, input().split())))
    except EOFError:
        break
for i in a:
    g = f(i[0], i[1])
    l = (i[0] * i[1]) / g
    print(g, int(l))

Python: import math

while True:
	try:
		a,b=list(map(int,input().split()))
		x=math.gcd(a,b)
		y=int(a*b/x)
		print("%d %d"%(x,y))
	except:
		break

Python: import sys

def findGCD(a, b):
  if b == 0:
    return a
  return findGCD(b, a%b)

if __name__ == "__main__":
  for line in sys.stdin:
    a, b = [int(i) for i in line.strip().split(" ")]
    GCD = findGCD(a,b)
    LCM = a*b//GCD
    print(GCD, LCM)

Python: def gcd(a,b):
	while b: a,b=b,a%b
	return a
while True:
	try:
		a,b = map(int,input().split())
		print(gcd(a,b),a*b//gcd(a,b))
	except:
		break;

Python: def F(x, y):
    if x % y == 0:
        return y
    return F(y, x % y)
while True:
    try:
        x, y = map(int,input().split())
        print('{0} {1}'.format(F(x, y), int(x * y / F(x, y))))
    except EOFError:
        break

Python: import sys

def gcd(inta, intb):
    large = max(inta, intb)
    small = min(inta,intb)
    mod = large % small
    if mod ==0:
        return small
    else:
        return gcd(small, mod) 
    
def lcm(inta, intb, intgcd):
    return (inta * intb // intgcd)

sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = gcd(a, b)
    print(c, lcm(a, b, c))

Python: ans = []

def gcd(a, b) :
    if a % b == 0 :
        return b
    else :
        return gcd(b, a % b)
        
def lcm(a, b) :
    return a * b // gcd(a, b)

while True :
    try :
        s = input()
        a, b = map(int, s.split())  
        m_gcd, m_lcm = gcd(a, b), lcm(a, b)
        ans.append([m_gcd, m_lcm])
    except :
        for a in ans :
            print(a[0], a[1])
        break

Python: import sys
  
for m,n in [map(int,x.split()) for x in list(sys.stdin)]:
    g,r = m,n
    while r!=0:
      g,r = r,g%r
    print(g,m//g*n)

Python: import math

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

Python: while True:
  try:
    ( a, b ) = map ( int, input ( ).split ( ) )
  except EOFError: break
  ( x, y ) = ( a, b )
  while x != 0:
    ( x, y ) = ( y % x, x )
  print ( "%s %s" % ( y, a * b // y ) )

Python: def pd(n):
    i = 2
    ans = []
    while i ** 2 <= n:
        while n % i == 0:
            n /= i
            ans.append(i)
        i += 1
    if n > 1:
        ans.append(n)
    return ans

def gcd(a, b):
    gcd = 1
    pd_a = pd(a)
    pd_b = pd(b)
    for i in pd_a:
        if i in pd_b:
            pd_b.remove(i)
            gcd *= i
    return int(gcd)

def lcm(a, b):
    lcm = a
    pd_a = pd(a)
    pd_b = pd(b)
    for i in pd_a:
        if i in pd_b:
            pd_b.remove(i)
    for j in pd_b:
        lcm *= j
    return int(lcm)

while True:
    try:
        s = input()
        a,b = [int(i) for i in s.split(' ')]
    except:
        break
    print(gcd(a, b), lcm(a, b))

Python: def gcd(a,b):
	while b > 0:
		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())
	gcd_num = gcd(a,b)
	lcm_num = lcm(a,b)
	print("{0} {1}".format(gcd_num,lcm_num))

Python: import sys
 
def gcd(inta, intb):
    large = max(inta, intb)
    small = min(inta,intb)
    mod = large % small
    if mod ==0:
        return small
    else:
        return gcd(small, mod) 
     
def lcm(inta, intb, intgcd):
    return (inta * intb // intgcd)
 
sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = gcd(a, b)
    print(c, lcm(a, b, c))

Python: def gcd(x, y):
    if x < y:
        x, y = y, x
    return x if y == 0 else gcd(y, x % y)


def run():
    while True:
        try:
            x, y = map(int, input().split())
            g = gcd(x, y)
            l = x * y // g
            print(g, l)
        except:
            break

if __name__ == '__main__':
    run()

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

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


if __name__ == "__main__":
    main()

Python: while(True):
    try:
        (a, b) = map(int, input().split(" "))
        (x, y) = (a, b)
        while (x != 0):
            (x, y) = (y%x, x)
        print("%s %s" %(y, a*b//y))
    except:
        break

Python: # -*- coding:utf-8 -*-

import sys

def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)

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

array = []
for i in sys.stdin:
    array.append(i)

for i in range(len(array)):
    n, m = array[i].split()
    n, m = int(n), int(m)
    print(int(gcd(n, m)),int(lcm(n, m)))