Go: package main

import "fmt"

func gcd(x, y int64) int64 {
	for y != 0 {
		r := x % y
		x = y
		y = r
	}
	return x
}

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

func main() {
	for {
		var a, b int64

		fmt.Scanf("%d %d", &a, &b)

		if a == 0 && b == 0 {
			break
		}

		fmt.Printf("%d %d\n", gcd(a, b), lcm(a, b))
	}
}

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;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,a1,b1,p,min,max;
	while(cin>>a>>b)
	{
		if(a<b){p=a;a=b;b=p;}
		a1=a;b1=b;
		while(a%b!=0)
		{
			c=a%b;
			a=b;
			b=c;
		}
		min=b;
		max=a1*b1/b;
		cout<<min<<" "<<max<<endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
    long a,b,t,m,n,l;
    while(cin >> a >> b)
     {
        if(a>=b){
         m=a;
          n=b; 
        }
        else{
         n=a;
         m=b; 
        }
       while(n!=0)
        {
          t = n;
          n = m%n;
          m= t;
        }
        l = a*b / m;
        cout << m << l << endl;
      }
 return 0;
}

C++: #include<iostream>

using namespace std;


int main() {
	unsigned long long n, m,r,tempn,tempm;
	while (cin >> n >> m) {
		tempn = n, tempm = m;
		if (n < m) { int t = n; n = m; m = t; }
		while (m) {
			r= n % m;
			n = m;
			m = r;
		}
		cout << n << ' ';
		int i;
		for (i = 1; (i*tempn) % tempm != 0; ++i);
			cout << tempn * i << endl;

	}
	return 0;
}