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>

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

int main(){
  int a, b, k;

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

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

void swap(int& a, int& b)
{
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
}

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

int main()
{
        int a, b;
        int g, l;

        while(scanf("%d %d", &a, &b) != EOF){
                if(a<b){ swap(a, b); }
                g = gcd(a, b);
                l = a/g*b;
                cout << g << " " << l << endl;
        }
        return 0;
}

C++: #include<iostream>
using namespace std;
long long gcd(long long ,long long);
int main(){
  long long a,b,c,d;
  cin>>a>>b;
  d=gcd(a,b);
  c=a*(b/d);
  cout<<d<<' '<<c<<endl;
  return 0;
}

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

C++: #include <iostream>
using namespace std;
int main()
{
   int a,b,d,e;
  cin>>a>>b;
  for(int i = a; i>0;i--){
    if(a%i== 0&& b%i == 0)
        d = i ;
}
 for(int j = a; j <= a*b;++j){
     if(j%a == 0&& j%b == 0){
       e =j;
     }
 }

 cout<<d<<" "<<e<<endl;
    return 0;
}

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

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

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

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

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

C++: #include <cstdio>
#include<iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstring>
#include <string.h>
#include<vector>
#include <set>
#include <vector>
#include <iterator>
using namespace std;
typedef long long int ll;

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

 int main()
 {
     ll a, b;
     while(~scanf("%lld %lld", &a, &b))
     {
         printf("%lld %lld\n", gcd(a, b), LCM(a, a, b));
     }
     return 0;
 }

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

long gcd(long, long);

int main()
{
	long a,b;

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

	return 0;

}

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

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

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

int gcd(int a, int b)
{
    int i;
    if (b > a){
        int j = a;
        a = b;
        b = j;
    }
	for (i = a; i >= 1; i--){
		if (a % i == 0)
			if( b % i == 0)
				return i;
	}
}


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 <string>
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <iomanip>


using namespace std;


int main(void) {
	int a, b;
	while(cin >> a >> b){
	int gcd = 1, lcm = a * b;
	if(a < b){
		a ^= b;
		b ^= a;
		a ^= b;
	}
	for(int i = 1;;i++){
		if(a * i % b == 0){
			lcm = a * i;
			break;
		}
	}
	for(int i = 2; i <= b; i++){
		if(a % i == 0 && b % i == 0){
			gcd *= i;
			a /= i;
			b /= i;
		}
	}
	
	cout << gcd << " " << lcm << endl;
	}
}

C++: include <iostream>
int GCD(int a, int b) {
 while (b!=0) {
  int r = a%b;
  a = b;
  b = r;
 }
 return a;
}
int main() {
 int a,b;
 while (std::cin>>a>>b) {
  int gcd = GCD(a,b);
  int lcm = a*b/gcd;
  std::cout << gcd << ' ' << lcm << std::endl;
 }
 return 0;
}

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

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

C++: //"push hoge"と言われたらhogeを最後に入れ、"pop"と言われたら最後尾を取りだす。"quit"で終わり。
#include<iostream>
using namespace std;

int main(){
	int a,b,hoge = 0,j=0;
	int gcd,gcds,lcm,lcms;

	while(cin >> a >> b){
		//最大公約数
		if(a > b){
			lcm = b;
			lcms = a;
		}else{
			lcm = a;
			lcms = b;
		}
		for(int i=1;i<=lcm;i++)
			if(!(lcms % (lcm / i)) && !(lcm % i)) {
				lcm = lcm / i;
				break;
			}
	
		j = 0;
		//最小公倍数
		if(a > b){
			gcd = a;
			gcds = b;
		}else{
			gcd = b;
			gcds = a;
		}
		while(1){
			j++;
			hoge = gcd * j;
			if(!(hoge % gcds)){
				gcd = hoge;
				break;
			}
		}

		cout << lcm << " " << gcd << endl;
	}
	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(){
  while(true){
    int a,b;
    cin >> a >> b;

    if(cin.eof())
    break;

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

  return 0;
}

C++: #include<iostream>
int g(int x,int y){return y?g(y,x%y):x;}
int main(){
int x,y;
while(std::cin>>x>>y)std::cout<<g(x,y)<<' '<<x*y/g(x,y)<<'\n';
}

C++: #include<iostream>
using namespace std;
int main(void){
    long a, b;
    while(cin >> a >> b){
        long _a = a, _b = b;
        long gcd, lcm;

        while(a%b != 0){
            gcd = a%b;
            a = b;
            b = gcd;
        }
        lcm = (_a * _b)/gcd;
        cout << gcd << ' ' << lcm << endl;
    }
}

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


 
int main(){
	int in[2],a,b,ans[2],i = 1,n,stop = 1;
	while(cin >> in[0] >> in[1]){
		a = in[0];
		b = in[1];
		if(a >= b){
			while(a >= 0){
				if(in[0] % a == 0 and in[1] % a == 0){
					ans[0] = a;
					break;
				}
				a--;
			}
		}else if(b >= a){
			while(b >= 0){
				if(in[0] % b == 0 and in[1] % b == 0){
					ans[0] = b;
					break;
				}
				b--;
			}
		}else{
			ans[0] = 1;
		}
		cout << ans[0] << endl;
		a = in[0];
		b = in[1];
		ans[1] = 1;
		n = 1;
		i = 1;
		while(i <= a or i <= b and stop == 1){
		n = 1;
		cout << " << i = " << i << endl;			
			while(i >= n){
				cout << "n = " << n << endl;
				if(a * i == b * n){
					ans[1] = a * i;
					stop = 0;
					break;
				}
				n++;
			}
		
		i++;
		}
		stop = 1;
		cout << ans[1] << endl;
		
	}
}