Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if count == 51 {
			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: import sys


def euc(n,m):
    if n == m:
        return m
    elif m == 1 | n == 1:
        return 1
    else:
        return euc(min(n,m), max(n,m)-min(n,m))


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

Python: def gcd(a, b):
    if a == 0 or b == 0:
        return 0
    while b != 0:
        a, b = b, a%b
    return a

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

Python: import math
john=[]
while True:
    try:
        john.append(input())
    except EOFError:
        break
for i in john:
    k=list(map(int,i.split()))
    print(int(math.gcd(k[0],k[1])),int(k[0]*k[1]/math.gcd(k[0],k[1])))

Python: import math

while True:
    try:
        a, b = [int(x) for x in input().split()]
        print(math.gcd(a,b), a*b // math.gcd(a,b))
    except EOFError:
        break

Python: import math

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

Python: import sys


def get_divisor(num):
    divisor_list = []
    for i in range(1, int(num/2)):
        divisor = num / i

        if divisor.is_integer():
            divisor_list.append(i)
            divisor_list.append(int(divisor))
    return list(set(divisor_list))


for line in sys.stdin.readlines():
    ab = [int(str_) for str_ in line.split()]

    a_list = get_divisor(ab[0])
    b_list = get_divisor(ab[1])

    matched_list = [b for b in b_list if b in a_list]
    g = max(matched_list)
    l = int(ab[0]*ab[1] / g)
    print("{} {}".format(g, l))

Python: import sys

def get_divisor(num):
    divisor_list = []
    for i in range(1, int(num/2)):
        divisor = num / i

        if divisor.is_integer():
            divisor_list.append(i)
            divisor_list.append(int(divisor))
    return list(set(divisor_list))

for line in sys.stdin.readlines():
    ab = [int(str_) for str_ in line.split()]

    a_list = get_divisor(ab[0])
    b_list = get_divisor(ab[1])

    matched_list = [b for b in b_list if b in a_list]
    g = max(matched_list)
    l = int(ab[0]*ab[1] / g)
    print("{} {}".format(g, l))

Python: #! /usr/bin/env python3

import sys

get = sys.stdin.read().split('\n')

for g in get:
	nums = list(map(int, g.split()))
	output = ''
	if (nums != []):
		# print(nums)
		[a, b] = nums
		while ((a != 0) and (b != 0)):
			larger = max([a, b])
			smaller = min([a, b])
			a = larger - smaller 
			b = smaller
		output += str(max([a, b])) + ' ' + str((nums[0]*nums[1])//max([a,b]))
		print(output)

Python: import math
def main():
    def get_inputs():
        input_list = []
        count = 0
        try:
            while count < 50:
                input_list.append(input())
                count += 1
        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: import fractions

lst = []
for i in range(200):
    try:
        lst.append(input())
    except EOFError:
        break

nums = [list(map(int, elem.split(' '))) for elem in lst]

# gcd 
res_gcd = [fractions.gcd(num[0], num[1]) for num in nums]

# lcm
res_lcm = [nums[i][0] * nums[i][1] // res_gcd[i] for i in range(len(nums))]

for (a, b) in zip(res_gcd, res_lcm):
    print('{} {}'.format(a, b))

Python: #!/usr/bin/env python3

while(True):
	try:
		a, b=map(int, input().split())
		
		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))

	except EOFError:
		break

Python: import math

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

Python: def GCD(a, b):
	if b > a:
		return GCD(b, a)
	elif a % b == 0:
		return b
	return GCD(b, a % b)
		
def LCM(a, b):
	return a * b / GCD(a, b)

import sys
L = sys.stdin.readlines()
for line in L:
	x, y = list(map(int, line.split()))
	print(GCD(x, y), LCM(x, y))

Python: def gcd(a, b):
    while b:
        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:
        break

Python: def GcdLCM():
    
    while 1:
        x,y=map(int,input().split())
        if x==None:
            break
        
        gcd = Gcd(x,y)
        lcm = int(x*y/gcd)

        print("{} {}".format(gcd,lcm))
       
def Gcd(x,y):
    while x!=0:
        x,y=y%x,x
    return y
        
    
GcdLCM()

Python: def gcd(a, b):
    if a == 0 or b == 0:
        return 0
    while b != 0:
        a, b = b, a%b
    return a

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

Python: import sys

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

for line in sys.stdin:
    a, b = sorted(list(map(int, line.split())))
    print(gcd(a, b), lcm(a, b))

Python: t = 0
while t == 0:	
	try:
		x,y=[int(i) for i in input().split()]
	except:
		break
	else:
		a = x * y
		if x < y:
			x,y =y,x
		while y > 0:
			r = x % y
			x = y
			y = r
		print(str(x) + " " + str(a/x))

Python: import sys


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


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


def main():
    for i in sys.stdin.readlines():
        a, b = [int(x) for x in i.split()]
        print(gcd(a, b), lcm(a, b))


if __name__ == '__main__':
    main()

Python: data_set = []
while True:
    try:
        k = list(map(int, input().split()))
        data_set.append(k)
    except:
        for k in data_set:
            a = k[0]
            b = k[1]
            
            r = a % b
            while r != 0:
                a = b
                b = r
                r = a % b
            else:
                ans1 = b
            
            
            a = k[0]
            b = k[1]
            
            v = a % b
            index = 2
            while v != 0:
                aa = a * index
                v = aa % b
                index = index + 1
            else:
                ans2 = aa
            
            print(ans1, ans2)
        break

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

import sys

def gcd(a, b):
    if a < b:
        a, b = b, a
    while b!=0:
        c = b
        b = a % b
        a = c
    return a

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

def main():
    for line in sys.stdin:
        a, b = map(int, line.split())
        ng = gcd(a, b)
        nl = lcm(a, b, ng)
        print('{0:d} {1:d}'.format(int(ng), int(nl)))

if __name__ == '__main__':
    main()

Python: import sys


def gcd(m, n):
  if n > m:
    m, n = n, m
  if n == 0:
    return m
  else:
    return gcd(n, m % n)


for line in sys.stdin:
  try:
    a, b = [int(i) for i in line.split()]
    g = gcd(a, b)
    l = a * b / g
    print("%d %d" % (g, l))
  except:
    break

Python: def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x

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

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