Go: package main

import (
	"fmt"
	"os"
	"bufio"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)

	for sc.Scan() {
		var a, b int
		fmt.Sscanf(sc.Text(), "%d %d", &a, &b)
		gcd := gcd(a, b)
		fmt.Printf("%d %d\n", gcd, (a/gcd)*b )
	}
}

func gcd(a int, b int) (gcd int) {
	var i, j, k int
	if a > b {
		i = a
		j = b
	} else {
		i = b
		j = a
	}

	k = i % j

	for k > 0 {
		num := i
		i = j
		j = num % i
		k = i % j
	}

	return j
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

long long int find_GCD(long long int a, long long int b){
  long long int max = 0;
  for(int i=min(a, b);i>0;i--){
    if(a%i==0 && b%i==0){
      max = i;
      break;
    }
  }
  return max;
}

int main(){
  long long int a, b;
  while(cin >> a >> b){
    //    cout << a << " " << b <<endl;
    //    int GCD = find_GCD(a, b);
    //    cout << GCD << endl;
    //    cout << find_GCD(a, b) << endl;
    long long int GCD = find_GCD(a, b);
    long long int LCM = a*b/GCD;
    cout << GCD << " " << LCM << endl;
  }

}

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

// GCD and LCM(0005)
int GCD(int a, int b)
{
	if (b == 0)
		return a;
	return GCD(b, a%b);
}

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

C++: #include <iostream>

using namespace std;

int gcd(int a,int b) {

  if(b==0) return a;

  else return gcd(b,a%b);

}

int main() {

  long long a,b;

  long long g,l;

  
  while(cin >> a >> b) {

    g=gcd(a,b);

    l=a*b/g;

    cout << g << " " << l << endl;

  }

  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!=0){
	q=b/a;
	r=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 <iostream>
using namespace std ;

int main()
{
	unsigned int a,b ;
	unsigned int x,y ;

	int gcd = 1 ;
	int lcm = 1 ;

	while( cin >> a >> b )
	{
		x = a ;
		y = b ;
		for( int i = 2 ; i < min(a,b) ; i ++ )
		{
			if( (a %i == 0 ) && (b %i == 0 ) )
			{
				gcd *= i ;
				a = a/i ;
				b = b/i ;

				i = 2 ;
			}
		}

		lcm = (x/gcd) * y ;

		cout << gcd << " " << lcm ;

		gcd = 1 ;
		lcm = 1 ;
	}

	return 0 ;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, s, t, i;
	
	while(cin >> a >> b){
		for(i = (a > b)? b : a; i >= 1; i--){
			if(b%i == 0 && a%i == 0){
				break;
			}
		}
		s = a;
		t = b;
		while(s != t){
			if(s > t){
				while(s > t){
					t += b;
				}
			} else {
				while(t > s){
					s += a;
				}
			}
		}
		cout << i << " " << s << endl;
	}
	
	return 0;
}

C++: #include <stdio.h>
int GCD(int a, int b) {while (b) {int c=a;a=b,b=c%b;} return a;}
int main() {int a,b,c;while (scanf("%d %d",&a,&b)!=EOF) {c=GCD(a,b);printf("%d %d\n",c,(a/c)*b);}return 0;}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;

int main() {
	int a,b,A,B;
	while(cin>>A>>B){
		a=A,b=B;

		if(a<b)swap(a,b);
		for(int r;(r=a-b)!=0;){
			a=b,b=r;
			if(a<b)swap(a,b);
		}

		int L=b,G=A*(B/L);
		cout<<L<<" "<<G<<endl;
	}
	return 0;
}

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

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

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

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

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

int main() {
	unsigned 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>
using namespace std;
int main(){
	int a,b,d=0,c,e;
	while(cin>>a>>b){
		c=a;
		e=b;
		if(a<b){
			d++;
		}
		while(a!=0&&b!=0){
			if(d%2==0){
				a%=b;
			}else{
				b%=a;
			}
			d++;
		}
		cout<<a+b<< " " <<c*(e/(a+b))<<endl;
	}
	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 x,y,l=0,g=0;
    while(scanf("%lld %lld",&x,&y)==2){
        printf("%lld %lld\n",gcd(x,y),(x*y)/gcd(x,y));
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
#define ll long long
ll gcd(ll a, ll b){
	return b == 0 ? a : 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) << "\n";
	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

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

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

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

}

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

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>
#include <ctype.h>
using namespace std;
int n,p,q=2,nn,pp;
long long lcm=1;
int main(){
	while(cin>>n>>p){
		nn=n;pp=p;
		while(1){
			if(n%q==0&&p%q==0){
			n/=q;p/=q;lcm*=q;q=2;}else{
			q++;}
			if(q>n&&q>p){
			break;}

		}
			cout<<lcm<<" "<<nn/lcm*pp<<endl;
			q=2;lcm=1;
	}
    return 0;}

C++: #include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<queue>
#include<set>
#include<map>

using namespace std;

#define ll long long
#define inf  1e15+7
#define MAXN 110
#define exp 1e-4

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

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

C++: #include<iostream>
using namespace std;
int main(){
  int a,b,r,G,R,L,tmp;
  while(cin >> a >> b){
    R = a; L = b;
    if(b > a){
      tmp = a; a = b; b = tmp;
    }
    while(1){
      r = a % b;
      if(r == 0)
        break;
      a = b;
      b = r;
       }
    G = b;
    R = R / G;
    L = L / G;
    cout << G <<" "<< R*L*G << endl;
  }
}

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

typedef long long ll;
ll gcd(ll a, ll b){
	return !b ? a : gcd(b, a % b); 
}

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