Go: package main

import "fmt"

func GCM(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return GCM(b, a % b)
}

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d\n", G, L)
	}
}

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

while 1:
    try:
        a,b=map(int,raw_input().split())
    except:
        break

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

Python: import sys

def gcd(x, y):
    if x < y:
        x, y = y, x
    while y > 0:
        x, y = y, x % y
    return x

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

Python: import sys
def kouyakusuu(a,b):
  A = max(a,b)
  B = min(a,b)
  d = A % B
  if d == 0:
    return B
  else:
    return kouyakusuu(B,d)
for line in sys.stdin.readlines():
  a,b = map(int,line.split())
  m = kouyakusuu(a,b)
  n = a*b//m
  print(m,n)

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

def LCM(a,b):
    return a / GCD(a,b) * b


while True:
    try:
        x = list(map(int,input().split()))
        ans_1 = GCD(x[0],x[1])
        ans_2 = LCM(x[0],x[1])
        print("%d %d"%(ans_1,ans_2))
    
    except:
        break

Python: import sys
import fractions

lines = []
for line in sys.stdin:
    num = line.split(" ")
    a, b = int(num[0]), int(num[1])
    gcd = fractions.gcd(a, b)
    print("{0} {1:.0f}".format(gcd, (a*b)/gcd))

Python: def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)
while True:
    try:
        a, b = map(int, input().split())
        d = gcd(max(a, b), min(a, b))
        print(d, a * b // d)
    except:
        break

Python: import sys

temp = []
largest = 1

for line in sys.stdin:
    a,b = [int(x) for x in line.split()]
    if a > b:
        x,y = a,b
    else:
        x,y = b,a
    while y:
        x,y = y,x%y
    smallest = x * (a/x) * (b/x)
    print('%d %d' % (x, smallest))

Python: def GCD(a,b):
    S=[a,b]
    S.sort(reverse=True)
    while S[1]>0:
        S2=[S[1],S[0]%S[1]]
        S=S2
    return S[0]
    
try:
    while True:
        a,b=[int(i) for i in input().split(" ")]
        G=GCD(a,b)
        L=int(a*b/G)
        print("%d %d"%(G,L))
except EOFError:
    pass

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

def main():
    while 1:
        try:
            a = list(map(int, input().split()))
            b = gcd(a[0],a[1])
            c = a[0]/b*a[1]
            #d = [b,c]
            print('%d %d' % (b,c))
        except:
            break
            
main()

Python: from sys import stdin
from sys import math

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

def LCM(a,b):
    gcd = GCD(a,b)
    return a*b/gcd

for line in stdin:
    a,b = line.split(" ")
    a = int(a)
    b = int(b)
    gcd = GCD(a,b)
    lcm = math.floor(LCM(a,b))

    print(str(gcd)+" "+str(lcm))
    print()

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

Python: import sys

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

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 sys


def calc(i1, i2):

    a = i1
    b = i2
    if (i1 < i2):
        a = i2
        b = i1
    
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b

    gcd = b
    lcm = (i1 * i2) / gcd

    return gcd, lcm


for line in sys.stdin:
    datas =line.split()
    if (len(datas)):

        li = list(map(int, datas)) 
        a = li[0]
        b = li[1]

        x, y = calc(a, b)

        print("%d %d" % (x, y))

    else:
        break

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

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


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

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

Python: # This program computes GCD and LCM
# -*- coding: utf-8
import sys


def gcd(a, b):
    g = 1
    for i in range(1, max([a, b])):
        if(a % i == 0 and b % i == 0):
            g = i
    return g


def lcm(a, b):
    for i in range(max([a, b]), a*b + 1):
        if(i % a == 0 and i % b == 0):
            return i
    return a*b


for i in sys.stdin:
    try:
        line = [int(k) for k in i.split(" ")]
        print(str(gcd(line[0], line[1])) + " " + str(lcm(line[0], line[1])))
    except:
        exit()

Python: import sys
for e in sys.stdin:
 a,b=list(map(int,e.split()));p=a*b
 while b:a,b=b,a%b
 print(a,p//a)

Python: import sys
def gcd(a, b):
    for i in range(1, a+1):
        if a % i == 0:
            t = a // i
            if b % t == 0:
                return t
for line in sys.stdin:
    a, b = sorted(map(int, line.split()))
    gcdab = gcd(a, b)
    print(gcdab, a // gcdab * b)

Python: def main():
    a,b=(int(x) for x in input().split())
    a1=a
    b1=b
    while b!=0:
        c=a%b
        a=b
        b=c
    print(a," ",a1*b1/a)

main()

Python: try:
    GCD = 0
    LCM = 0
    while True:
        lists = list(map(int, input().split()))
        l = sorted(lists)
        num = l[0] * l[1]
        while l[0] < l[1]:
            GCD = l[1] - l[0]
            l[1] = GCD
            l = sorted(l)
            LCM = int(num / GCD)
        print(str(GCD) + " " + str(LCM))
 
        
except EOFError:
    pass

Python: def gcd(a, b):
    if a == 0:
        return b
    else:
        return gcd(b%a, a)
def lcm(a, b):
    return a*b//gcd(a, b)
while 1:
    try:
        a,b = map(int, input().split(" "))
        print(gcd(a, b),lcm(a, b))
    except:
        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 EOFError:
    pass

Python: import sys

for i in sys.stdin:
    a,b=list(map(int, i.split()))
    d=a*b
    if a>b:
        temp=a
        a=b
        b=temp
    c=a%b
    while c!=0:
        a=b
        b=c
        c=a%b
    g=b
    l=int(d/g)
    print("{} {}".format(g,l))

C++: #include<bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(ll a,ll b){
	return a%b?gcd(b,a%b):b;
}
int main(){
	ll a,b;
	while(cin>>a>>b)
		cout<<gcd(max(a,b),min(a,b))<<" "<<a*b/gcd(max(a,b),min(a,b))<<endl;
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
	ios :: sync_with_stdio(false);
	int x, y;
	while(cin >> x >> y) {
		cout << __gcd(x, y) << ' ';
		cout << x / gcd(x, y) * y << '\n';
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main()
{
    int a,b,box1,box2;
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        box1=a;
        box2=b;
        while(b)
        {
            int q=a%b;
            a=b;
            b=q;
        }
        printf("%d %d\n",a,box1/a*box2);
    }
    return 0;
}