Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"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)
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

int gcd(int,int);

int main()
{
	int a,b,GCD,LCM;

	while(scanf("%d %d",&a,&b) != EOF)
	{
		GCD = gcd(a,b);

		LCM = (a*b) / GCD;

		printf("%d\n%d\n",GCD,LCM);
	}

	return 0;
}

int gcd(int a,int b){
	if(b == 0)	return a;
	return gcd(b, a % b);
}

C++: #include <iostream>
using namespace std;

int main() {
	int a,b;
	while(cin>>a>>b){
	int gcd=a,lcm=b,sto;;
	while(lcm!=0)
	{
		sto=lcm;
		lcm=gcd%lcm;
		gcd=sto;
	}
	cout<<gcd<<" "<<(a/gcd)*b<<endl;}
	return 0;
}

C++: #include <iostream>
#include <utility>

int main(){

	int a, b;

	while(std::cin >> a >> b){

		long int minmul = a * b; //least common multiple
		int maxdivi = 1; //greatest common divisor

		if(a == 0 || b == 0){
			std::cout << 0 << " " << 0 << std::endl;

		}else{					//Euclidean Algorithm

			if(b > a)
				std::swap(a, b);

			while(a % b != 0){
				a = a % b;
				if(b > a)
					std::swap(a, b);
			}
		
		maxdivi = b;
		minmul = minmul / maxdivi;

		std::cout << maxdivi << " " << minmul << std::endl;
		}
	}

	return 0;
}

C++: #include<stdio.h>
int main(){
	long long int a,b,x,y;
	scanf("%lld%lld",&a,&b);
	x=a;
	y=b;
	while(a!=b){
		if(a>b){
			a-=b;
		}
		else{
			b-=a;
		}
	}
	printf("%lld %lld",a,x/a*y);
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;

int gcd(int a, int b){

int p,q,r;

if(a<b){p=b;b=a;a=p;

}

while((r=b%a)!=0){
   q=b/a;
   b=a;
   a=r;
}
   
   return a;
}

int main(void)
{    int a, b;
    while(cin >> a >> b) {
      int lcm = a/gcd(a,b)*b;
      cout << gcd(a,b) << " " << lcm << endl;
    }
    return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a = 0,b = 0;
	int ans1 = 0,ans2 = 0,hozon = 0;
	int cnt1 = 2,cnt2 = 2;

	while (scanf("%d %d",&a,&b) != EOF)
	{
		cnt1 = 2;
		cnt2 = 2;
		if (a == b)
		{
			ans1 = a;
			ans2 = a;
		}
		else if (a % b == 0)
		{
			ans1 = b;
			ans2 = a;
		}
		else if (b % a == 0)
		{
			ans1 = a;
			ans2 = b;
		}
		else
		{
			ans1 = a;
			ans2 = b;
			if (ans1 < ans2)
			{
				hozon = ans1;
			}
			else
			{
				hozon = ans2;
			}
			while (1)
			{
				if (a % hozon == 0 && b % hozon == 0)
				{
					break;
				}
				hozon -= 2;
			}
			while (1)
			{
				while (ans1 < ans2)
				{
					ans1 = a * cnt1;
					cnt1++;
				}
				while (ans2 < ans1)
				{
					ans2 = b * cnt2;
					cnt2++;
				}
				if (ans1 == ans2)
				{
					break;
				}
			}
		}
		printf("%d %d\n",hozon,ans2);
	}

	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
	int a, b, c, d;
	while(cin >> a >> b) {
		c = a;
		d = b;
		while (1) {
			if ((max(a, b) % min(a, b)) == 0) {
				cout << min(a, b);
				break;
			}else if(a > b) {
				a  = a%b;
			}else b = b%a;
		}
			cout << " " << c * d / min(a,b) << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	
	int a, b, c = 0;
	while (cin >> a, cin >> b)
	{
		for (int i = 1; i <= a, i <= b; i++)
		{
			if (a % i == 0 && b % i == 0)
			{
				c = i;
			}
		}
		cout << c << " " << a*b / c << endl;
	}
	getchar();
	getchar();
	return 0;
}

C++: include<iostream>
#include<cstdio>
using namespace std;

int main(){

  long long int a,b,c,r,s;

  while(cin >> a >> b){

    s=a*b;

    while(b!=0){

      c=a/b;
      r=a%b;
      a=b;
      b=r;

    }

    cout << a << ' ' << s/a <<  endl;
  }

  return 0;
}

C++: #include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	long a, b, r, c, d;
	long ta, tb;

	scanf("%d%d", &a,& b);
	ta = a;
	tb = b;

	while (1) {
	r = ta % tb;
	if (r == 0) break;
	ta = tb;
	tb = r;
	}
	c = tb;

	if (a > b)
		d = b * (a  / c);
	else
		d = a * (b  / c);

	printf("%d %d\n", c, d);

	return (0);
}

C++: #include <iostream>
#include <stdio.h>

int GCD(int A, int B) {
    if (B == 0) return A;
    
    return GCD(B, A % B);
}

int main() {
    int a, b;
    
    while (std::cin >> a && std::cin >> b) {
        int gcd = GCD(a, b);
        printf("%d %d\n", gcd, a/gcd*b);
    }
    
    return 0;
}

C++: #include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
long long gcd(long long p, long long q){
	long long r;
	if (p > q){
		r = p;
		p = q;
		q = r;
	}
	if (q%p == 0) return p;
	else return gcd(q - (p*(q / p)), p);
}
int main(void){
	long long a, b, g;
	for (; scanf("%lld %lld", &a, &b) != EOF;){
		g = gcd(a, b);
		printf("%lld %lld\n", g, a*b / g);
	}
		return 0;
	}

C++: #include <iostream>
using namespace std;

long GCD(long a,long b);

int main(void){
    long a,b;
    long gcd,lcm;
    while(cin>>a>>b){
        gcd=GCD(a,b);
        lcm=a*b/gcd;
        cout<<gcd<<" "<<lcm<<endl;
    }
    return 0;
}


long GCD(long a,long b){
    if(min(a,b)==0){return max(a,b);}
    return GCD(min(a,b),max(a,b)%min(a,b));
}

C++: 
#include <string>
#include <iostream>
#include <sstream>

long long unsigned int __gcd(long long unsigned int a, long long unsigned int b)
{
//    std::cout << "in __gcd\n";
//    std::cout << "a: " << a << "\nb: " << b << '\n';
    if (b % a == 0) {
//        std::cout << "returning " << a << '\n';
        return a;
    } else {
        return __gcd(b % a ,a);
    }
}

long long unsigned int gcd(long long unsigned int a, long long unsigned int b)
{
    if (a > b)
        return __gcd(b, a);
    return __gcd(a, b);
}

long long unsigned int lcm(long long unsigned int a, long long unsigned int b)
{
    return a * b / gcd(a, b);
}

int main(void)
{
    int a, b;
    std::string str;

    while (getline(std::cin, str)) {
        std::istringstream str_s(str);
        str_s >> a >> b;

        std::cout << gcd(a, b) << ' ' << lcm(a, b) << std::endl;
    }
    
    return 0;
}

C++: #include<iostream>
using namespace std;

int main(){
  int a,b,ky,kb,t,k;

  for(int n=0;n<50;n++){
    cin>>a;
    cin>>b;
    t=1;
    for(int i=1;i<20000;i++){
      if(a%i==0&&b%i==0){
        a=a/i;
        b=b/i;
        t=i*t;
      }
    }
    k=t*a*b;
    cout<<t<<" "<<k;
  }
  return 0;
}

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

int main(){
	int a, b;
	while(cin >> a >> b){
		cin >> a >> b;
		//find gcd
		int gcd = 0;
		for(int i = 1; i <= max(a, b); i++){
			if(a % i == 0 and b % i == 0) gcd = max(gcd, i);
		}
		//find lcm
		int idx = 0;
		int lcm = 0;
		while(!lcm){
			idx++;
			if(idx % a == 0 and idx % b == 0) lcm = idx;
		}
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    int a, b;
    while (scanf("%d%d", &a, & b) != EOF) {
        int p = gcd(a, b);
        printf("%d %d\n", p, a / p * b);
    }
}

C++: #include <cstdio>
#include <algorithm>

using namespace std;

int gcd(int x, int y){ return y == 0 ? x : gcd(y, x % y); }
int lcm(int x, int y){ return x / gcd(x, y) * y; }

int main()
{
	int x, y;
	while (~scanf("%d%d", &x, &y)){
		printf("%d %d\n", gcd(x, y), lcm(x, y));
	}
}