Go: package main

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

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

C++: #include<iostream>
using namespace std;
int main() {
    long long a,b,t,GCD,LCM,g;
    while(cin >> a >> b) {
        g = a*b;
        while(b) {
            t = b;
            b = a % b;
            a = t;
        }
        GCD = a;
        LCM = g/a;
        cout << GCD << " " << LCM << endl;
    }
    return 0;
}

C++: #include<iostream>

int main(){
	long int a, b, r;
	
	while(std::cin >> a >> b){
		long int product = a*b;
		
		// GCD
		if(a < b){
			long int temp = a;
			a = b;
			b = temp;
		}
		while((r = a%b) != 0){
			a = b;
			b = r;
		}
		
		// LCM
		long int lcm = product / b;
		
		// show
		std::cout << b << " " << lcm << std::endl;
	}
	
	return 0;
}}

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

using namespace std;

int main()
{
	int gcd, lcm, a, b;

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

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

using namespace std;

int d(int, int);
int dd(int, int);

int main(){
  int a, b;
  while(cin >> a >> b)
  {
    printf("%d %d\n", d(a, b), dd(a, b));
  }
  return 0;
}

int d(int a, int b)
{
  if(a == 0)
    return b;
  if(b == 0)
    return a;
  if(a > b)
  {
    return d(b, a % b);
  }
  else
    return d(a, b % a);
}

int dd(int a, int b)
{
  return a  / d(a, b) * b;
}

C++: #include <iostream>

using namespace std;

typedef long long int lli;

lli gcd(lli a, lli b)
{
  return (b>0)? gcd(b, a%b) : a;
}

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

int main()
{
  lli a, b;

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

  return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
	while(cin >> a >> b) {
		int g = min(a, b);
		while(true) {
			if(a % g == 0 && b % g == 0) break;
			g--;
		}
		cout << g << ' ' << a / g * b << endl;
	}
}

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

int main(){
	long long unsigned int a, b, gcd, lcm, x, y, r;
	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r = x % y){
			x = y;
			y = r;
		}
		gcd = y;
		lcm = a * b / gcd;

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

	return 0;
}

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