Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

C++: #pragma GCC optimize(2)
#define LOCAL0
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
#define xx first 
#define yy second
#define INF 0x3f3f3f3f
void read(int &p)
{
    p=0;int flag=1;char c=getchar();
    while(!isdigit(c)) {if(c=='-') flag=-1;c=getchar();}
    while(isdigit(c)) {p=p*10+c-'0';c=getchar();}p*=flag;
}
ll x,y;

ll gcd(ll a,ll b){
    return b==0?a:gcd(b,a%b);
}

ll lcm(ll a,ll b){
    return max(a,b)/gcd(a,b)*min(a,b);
}

int main()
{
    #ifdef LOCAL
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
    while(cin>>x>>y) printf("%lld %lld\n",gcd(x,y),lcm(x,y));
    return 0;
}

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

using namespace std;

int a, b;
int gcd, lcm;

void GCD(){

	int big, small;

	big = a;
	small = b;

	while (big) {
		if (small > big) swap(big, small);
		big = big % small;
	}
	gcd = small;

}

void LCM() {
	lcm = a * b / gcd;
}




int main(){
	while (1) {

		GCD();
		LCM();
		cout << gcd << " " << lcm << endl;
	}
	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 %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;

typedef long long ll;

ll gcd(ll a, ll b){
return a != 0 ? gcd(b % a, a) : b;
}

int main() {
ll a, b;
while(cin >> a >> b)
cout << gcd(a, b) << " " << a / gcd(a, b) * b << endl;}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,g,x,y,L,i=0;
while(i>50){
cin>>a>>b;
x=a;y=b;
while(1){

  if(x<y){y-x;}
  else if(x>y){x-y;}
  else if(x==y){g=x;break;}
}
L=(a*b)/g;
if(a==0 || b==0){cout<<0<<" "<<0<<endl;}
else{cout<<g<<" "<<L<<endl;}
  ++i;
}
  return 0;
}

C++: #include<iostream>
int GCD(int x,int y){
	while(x%y!=0){
		int z=x%y;
		x=y;
		y=z;
	}
	return y;
}
int main(){
	int a=0,b=0;
	while(std::cin>>a>>b){
		std::cout<<GCD(a,b)<<" "<<a*b/GCD(a,b)<<std::endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
    long long  a,b,c,A,B;
    while(cin >> a >> b){
        A=a;
        B=b;
        while(b!=0){
            c=a%b;
            a=b;
            b=c;
        }
    cout<<a<<' '<<A/a*B<<endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
	while(cin >> a >> b) {
	  cout << __gcd(a, b) << " " << (a*b)/__gcd(a, b) << endl;
	}
  return 0;
}

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

unsigned long calc_gcd(unsigned long a, unsigned long b) {

  while(b != 0) {
    unsigned long c = b;
    b = a % b;
    a = c;
  }
  return a;
}

int main() {
  unsigned long a,b;

  while(scanf("%ld %ld", &a, &b) != EOF) {
    unsigned long gcd = calc_gcd(a, b);
    std::cout << gcd << " " << a*b/gcd << std::endl; 
  }
}

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

int max(int a, int b){
    
    if(a == 0 || b == 0){
        return 0;
    }
    
    while(a != b){
        if(a > b){
            a = a - b;
        }else{
            b = b - a;
        }
    }
    
    return a;
}

int min(int a, int b){
    int d;
    
    d = a * b / max(a, b);
    
    return d;
}

int main()
{
    int a, b;
    
    while(cin >> a >> b){
        cout << max(a, b) << " " << min(a, b) << endl;
    } 
    
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEFINE
#include "../../DEBUG.hpp"
#endif

int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long a, b;
  while (cin >> a >> b) {
    long long gg = __gcd(a, b);
    long long l = (a * b) / gg;
    cout << gg << " " << l << '\n';
  }
  return 0;
}

C++: #include <iostream>

inline u_long lcm(u_long a, u_long b) {
    return a * b / std::__gcd(a, b);
}

int main(void) {
    u_long a, b;

    while (std::cin >> a >> b) {
        std::cout << std::__gcd(a, b) << " " << lcm(a,b) << std::endl;
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
typedef long long int ll;
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	return a*b / gcd(a, b);
}
int main()
{
	ll a, b;
	while (cin >> a >> b) {
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
    return 0;
}

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

int gcd(int a,int b){return b? gcd(b,a%b):a;}
int lcm(int a,int b){return a / gcd(a,b) * b;}

int main()
{
	int a,b;
	while(scanf("%d %d",&a,&b) != EOF) {
		printf("%d %d\n",gcd(a,b),lcm(a,b));
	}
	return 0;
}

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

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

int main(){
    long long i,j;
    while(scanf("%lld %lld",&i,&j)==2){
    printf("%lld %lld\n",gcd(i,j),(i*j)/gcd(i,j));
    }
    return 0;
}

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

int main(){
   unsigned long long int a, b, tmp, m=0, s=0, ai, bi;
   while(cin >> a >> b){
      ai=a; bi=b;
      while(1){
         if(a<b){
            tmp=a;
            a=b;
            b=tmp;
         }
         if(a%b==0){
            m=b;
            break;
         }else a=a%b;
      }
      s=ai*bi/m;
      cout<< m << " " << s << endl;
   }
   return 0;
}

C++: #include<stdio.h>

int GCD(int x,int y)
{
	if(y==0)
		return x;
	return GCD(y,x%y);
}

int LCM(int x,int y)
{
	for(int i=1;i<=y;i++)
	{
		if((x*i)%y==0)
			return x*i;
	}
	return x*y;
}

int main()
{
	int x,y;
	while(scanf("%d%d",&x,&y)!=EOF)
	{
		if(x>y)
		{
			int temp=y;
			y=x;
			x=temp;
		}
		printf("%d %d\n",GCD(x,y),LCM(x,y));
	}
}

C++: #include <iostream>

using namespace std;

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

	return b;
}


int main (void){
	long long a,b,r;
	while(cin>>a>>b){
		if(a<b){
			a+=b;
			b=a-b;
			a-=b;
		}

		cout<<gcd(a,b)<<" "<<a*b/gcd(a,b)<<endl;
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

int gcd(int a, int b){
    return b ? gcd(b, a%b) : a;
}

int main(int argc, char ** argv) {
    int a, b;
    while (~scanf("%d%d", &a, &b)){
        int g = gcd(a, b);
        int l = a / g*b;
        printf("%d %d\n",g,l);
    }
}

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

int main(){

	int a,b,GCD,LCM,c;

	while(cin>>a>>b){

		if(a>b){
			c=b;
		}
		else{
			c=a;
		}

		for(int i=1;i<=(c/2+1);i++){
			if(b%i==0 && a%i==0){
				GCD = i;
			}
		}
		if(b%a==0 || a%b==0){
			GCD = c;
		}
		LCM=a/GCD*b;
		cout<<GCD<<" "<<LCM<<endl;
	}

	return 0;
}

C++: #include <iostream>

// Greatest Common Divisor 最大公約数
int GCD( int a, int b) {
	int bi, sm, r;
	if(a>b) {bi = a; sm = b;} else {bi = b; sm = a;}
	r = bi % sm;
	if(r==0) return sm;
	return GCD( sm, r);
}

// Least Common Multiple 最小公倍数
// gcd( a, b) * lcm( a, b) = a * b

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