Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"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 <iostream>

using namespace std;

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

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

int gcd(int x, int y)
{
    while(true){
        x=x%y;
        if(x==0) return y;
        y=y%x;
        if(y==0) return x;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, y;
    while(cin>>x>>y){
        int g=gcd(x, y);
        int l=x/g*y;
        cout<<g<<' '<<l<<'\n';
    }
    return 0;
}

C++: #include<iostream>
#include<utility>
using namespace std;
int main()
{
  long long int n=0,m=0;
  long long int i=0,j=0,l=0;

  while(scanf("%d %d",&n,&m) != EOF)
    {
      i = n;
      j = m;

      //koyaku
      if((n >= m) != true)swap(n,m);
      while(1)
	{
	  int amari = n % m;
	  n = m;
	  m = amari;
	  if(amari == 0) break;
	}
      
      //kobai
      l = i*j/n;
      
      cout << n << " " << l << endl;
    }
}

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

using namespace std;

int main()
{
    int a,b;

    while(scanf("%d%d",&a,&b)!=EOF){
        int gcd=a,tmp_b=b;
        int tmp;
        while(tmp_b!=0){
            tmp=gcd%tmp_b;
            gcd=tmp_b;
            tmp_b=tmp;
        }

        printf("%d %d\n",gcd,(int)((long)a*b/(long)gcd));
    }

    return 0;
}

C++: #include<stdio.h>

int max(int a, int b){
  return (a > b) ? a : b;
}

int min(int a, int b){
  return (a < b) ? a : b;
}

int calcGCD(int a, int b){
  int _min, _max, r;
  _max = max(a, b);
  _min = min(a, b);
  r = _max % _min;
  while(r != 0){
    _max = _min;
    _min = r;
    r = _max%_min;
  }
  return _min;
}

int calcLCM(int a, int b){
  int GCD, LCM;
  GCD = calcGCD(a, b);
  LCM = a * b / GCD;
  return LCM;
}
int main(){
  int a, b;
  int list[50][2];
  int j = 0;
  while(scanf("%d%d", &a, &b)!=EOF){
    list[j][0] = calcGCD(a, b);
    list[j][1] = calcLCM(a, b);
    j+=1;
  }
  int i;
  for(i=0; i<j; i++){
    printf("%d %d\n", list[i][0], list[i][1]);
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int calcGcd(int x, int y)
{
    int r;

    if (x < y)
    {
        swap(x, y);
    }

    while(y > 0)
    {
        r = x % y;
        x = y;
        y = r;
    }

    return x;
}

int main( )
{
    int a, b;
    int gcd, lcm;
 
    while(cin >> a >>  b)
    {
        gcd = calcGcd(a, b);
        lcm = a / gcd * b;

        cout << gcd << " " << lcm << endl; 
    }

    return 0;
}

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

int gcd( unsigned int, unsigned int );
int main(void)
{
	unsigned int a, b, g, l;

	while( std::cin >> a >> b ){
		g = gcd( a, b );
		l = a * b / g;
		std::cout << g << std::endl;
		std::cout << l << std::endl;
	}

	return 0;
}

int gcd( unsigned int a, unsigned int b ){
	int n, i;
	unsigned int tmp[4];

	tmp[0] = std::max( a, b );
	tmp[1] = std::mix( a, b );

	for( n = 0;; n++ ){
		for( i = 1;(tmp[( n + 2 ) % 3 ] = tmp[ n % 3 ] - tmp[( n + 1 ) % 3 ] * i ) >= tmp[( n + 1 ) % 3]; i++ ){
			if( tmp[( n + 2 ) % 3 ] == 0 ){
				return tmp[( n + 1 ) % 3 ];
			}
		}
		if( n > 2000000000 ){
			return -1;
		}
	}

	return -1;
}

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

int main()
{
    unsigned long long a, b;

    while( cin >> a >> b )
    {

        if( a > b && a % b == 0 )       //値が大きい場合の最大公約数を先に求めておく
        {
            cout << b << " " << a << endl;
            break;
        }
        if( b <= a && b % a == 0 )
        {
             cout << a << " " << b << endl;
            break;
        }

        for( int i = a; i > 0; i-- ) 
        {
                if( a % i == 0 && b % i == 0 ) 
                {
                    cout << i << " " << a * b / i << endl;
                    break;
                }
        }
    }
    return 0;
}

C++: #include <stdio.h>
#include <string>
#include <string.h>
#include <cstring>
#include <algorithm>

using namespace std;

long int a,b,gcd,lcm;

int main()
{
	while(scanf("%ld %ld", &a, &b) != EOF)
	{
	for(int i=1;i<=a&&i<=b;i++)
	{
		if(a%i==0&&b%i==0)
		{
			gcd=i;
		}
	}
	lcm=max(a,b);
	do {
    if (lcm%a == 0 && lcm%b == 0) {
            break;
        }
        else
            lcm=lcm+gcd;
    }
    while (true);
    printf("%ld %ld\n",gcd,lcm);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;


long long gcd(long long x,long long y){
    while(x%y!=0){
        long long tmp;
        tmp=x;
        x=y;
        y=tmp%y;
    }
    return y;
}

long long lcm(long long x,long long y){
    return x*y/gcd(x,y);
}

int main(){
    long long a,b;
    while(scanf("%lld %lld",&a,&b)!=EOF){
        long long g,l;
        if(a<b){
            swap(a,b);
        }
        g=gcd(a,b);
        l=lcm(a,b);
        printf("%lld %lld\n",g,l);
    }
    return 0;
}

C++: #include <iostream>
#include<cstdio>
#include<queue>
#include<cmath>
using namespace std;
int n,m;

int GCDi(int a,int b){
    int t;
    t = a%b;
    if(a%t &&  b%t ){
       return  GCDi(b,t);
    }
    else return t;
}
int LCMi(int a,int b){
    int t;
    t = GCDi(a,b);
    return a/t*b;
}
int main(){
    while(~scanf("%d%d",&n,&m)){
        int q,r;
        if(n > m){q = GCDi(n,m);r =LCMi(n,m);}
        else if(n > m){q = GCDi(m,n) ;r =LCMi(m,n);}
        else {
            q =n;r = n;
        }
        cout<<q<<" "<<r<<endl;
    }return 0;
}

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

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

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

int Gcd(int a,int b){
    int c,d;
    if(b>a){
        d=a;
        a=b;
        b=d;
    }
    while(b!=0){
        c=b;
        b=a%b;
        a=c;
    }
    int g=a;
    return(g);
}

int main(){
    int m,n;
    long p;
    int k;
    while(cin>>m>>n){
        p=m*n;
        k=Gcd(m,n);
        cout<<k<<" "<<p/k<<endl;
    }
}
}

C++: #include <iostream>

using namespace std;

typedef long long ll;

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) << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;

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

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

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

//typedef long long lli;

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

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