Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		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
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

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

int gcd(int a, int b)
{
	unsigned int c;

	while (a%b)
	{

		c = b;
		b = a%b;
		a = c;
	}
	return b;
}

int lcm(int a, int b)
{
	unsigned int c;
	if (a < b)
	{
		c = a;
		a = b;
		b = c;
	}

	for (int i = 1; i <= b; i++)
	{
		if (!(a*i%b))
			return a*i;
	}
}
int main()
{
	unsigned int a, b;
	while (scanf("%lld%lld", &a, &b))
	{
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
	return 0;
}

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

int main(void){
  int i,a,b,temp,r,lcm;

  while(cin >> a >> b){
    if(a<b){
      temp=a;
      a=b;
      b=temp;
    }

    int x=a,y=b;

    while(b>0){
      r=a%b;
      a=b;
      b=r;
    }

    lcm=x*(y/a);
    printf("%d %d\n",a,lcm);
  }

  return 0;
}

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

int main() {
	long long a,b,e,f,l;
	while(cin>>a>>b){
		e=a;
		f=b;
		while(1){
		if(e>f){
			e=e%f;
		}
	    if(f>e){
	    	f=f%e;
	    }
	    if(f==e){
	    	l=e;
	    	cout<<l<<" "<<(a*b)/l<<endl;
	    	break;
	    }
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>
#include <cassert>

typedef long long ll;
typedef unsigned long long ull;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

constexpr ll NOT_SPECIFIED_VALUE_MIN = INT64_MIN;
constexpr ll NOT_SPECIFIED_VALUE_MAX = INT64_MAX;

template <typename T>
T gcd(T a, T b) {
	if (a < b) gcd(b, a);
	T r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}

template <typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

int main() {
	ll a, b;
	a = b = -1;
	while (true) {
		cin >> a >> b;
		if (a == -1) { break; }
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
		a = b = -1;
	}
}

C++: #include <iostream>

using namespace std;

long long gcd(long long a, long long b);
long long lcm(long long a, long long b);

int main()
{
    long long  a, b;
    
    while (cin >> a >> b) {
        if (a < b) {
            long long temp = a;
            a = b;
            b = temp;
        }
        
        cout << gcd(a, b) << " " << lcm(a, b) << endl;
    } 
    
    return 0;
}

long long gcd(long long a, long long b)
{
    long long r;

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

    return b;
}

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

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

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


int main() {
    ios::sync_with_stdio(false);
    int a, b, g, l;
    while(cin >> a >> b){
      g = gcd(a, b);
      l = a*b/g;
      cout << g << " " << l << endl;
    }
    return 0;
}

C++: #include<cstdio>

int main(){
	long long a,b,g,l,t;
	while(scanf("%d %d", &a, &b) + 1){
		if(a > b){
			t = a;
			a = b;
			b = t;
		}
		if(b % a){
			t = a / 2;
			for(int i = t; i > 0; i--){
				if(!(a % i)){
					if(!(b % i)){
						g = i;
						i -= t;
						printf("%lld %lld\n", g, a * b / g);
					}
				}
			}
		}else{
			printf("%lld %lld\n", a, b);
		}
	}
	return 0;
}

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