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 i = 0;int a = 0;int b = 0;int aa = 0;int bb = 0;
while(!cin.eof()){
cin >> a >> b;
if(a >= b){
aa = b;bb = a;
}
else{
aa = a;bb = b;
}
while(bb != 1){
int c = 0;
c = aa;
aa = bb;
bb = c;
bb = bb%aa;
}
cout << aa << " " << a * b / aa << endl;

}
    return 0;
}

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

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

C++: #include<iostream>

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

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

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cin >> a >> b;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

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

long gcd(long a,long b){
	while(a!=b){
		if(a>b){
			a-=b;
		}else{
			b-=a;
		}
	}
	return a;
}

int main(){

	long a,b,c;

	while(cin >> a){
		cin >> b;
		c = gcd(a,b);
		printf("%d %d\n",c,a/c*b);
	}
	return 0;
}

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

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

C++: #include <iostream>

#define MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x>y)?y:x)
int main(void)
{
	while(true)
	{
		int x=0,y=0,product;
		std::cin >> x >> y;
		if(std::cin.eof())
			break;
		product = x*y;
		//ユークリッドの何とか
		while(x && y){
			std::cout << x << y << std::endl;
			if(x>y)
				x = x % y;
			else
				y = y % x;
		}
		std::cout << (int)x << " " << (int)(product/x) << std::endl;//確かGCD*LCMと元の積は等しいはず。
	}
	return 0;
}

C++: #include<stdio.h>

int min(int a,int b){
  int t=a;
  if(t>b) t=b;
  return t;
}

int main(void){
  int a,b,g,l;
  int m;
  char line[100];

  fgets(line,sizeof(line),stdin);
  sscanf(line,"%d %d",&a,&b);

  m=min(a,b);
  int i=m;
  for(i;i>=1;i--){
    if(a%i==0 && b%i==0){
      g=i;
      i=0;
    }
  }

  l=a*b/g;

  printf("%d %d",g,l);
  return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    ll a,b;
    while(true){
        cin>>a>>b;
        if(b>a)swap(b,a);
        ll aa=a,bb=b;
        ll o,p,q;
        while(bb!=0){
            o=bb;
            p=aa%bb;
            aa=bb;bb=p;
        }
        ll i=1;
        while(true){
            i++;
            ll ao=a*i;
            if(ao%b==0){
                q=ao;
                break;
            }
        }
        cout<<o<<" "<<q<<endl;
    }
   
    
    
    
return 0;
}

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

int main()
{
	int a, b;
	int c, d;
	int i = 2;
	int j = 2;
	
	while(1)
	{
		cin >> a >> b;
		c = a;
		d = b;
		
		while(c != d){
			if(c < d){
				c = a * i;
				i++;
			}else if(c > d){
				d = b * j;
				j++;
			}
		}
		
		/**********************************/
		
		int e, f;
		int k = 2;
		int l = 2;
		e = a;
		f = b;
		
		while(e != f){
			if(e > f){
				e = a / k;
				k++;
			}else if(e < f){
				f = b / l;
				l++;
			}
		}
		
		
		cout << e << " " << c << endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
using namespace std;

#define MAX 256

int main(void){
	
	int max[50], min[50];
	for (int i = 0; i < 50; i++){
		max[i] = 0;
		min[i] = 0;
	}

	int a, b;
	int i = 0;

	while (scanf("%d%d", a, b) != EOF){
		while (max[i] == 0){
			for (int j = 0; j > 0; j--){
				if (a%j == 0 && b%j == 0)max[i] = j;
			}
		}
		int j = 1;
		while (min[i] == 0){
			if ((a*j) % b == 0)min[i] = a*j;
			j++;
		}
		i++;
	}

	for (int j = 0; j < i; j++){
		printf("%d %d\n", max[j], min[j]);
	}

	return 0;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	int a[2];
	int tmp;
	int GCD = 1;
	int LCM = 1;
	while (cin >> a[0] >> a[1])
	{
		// ????????????????????????
		if (a[0] < a[1]) {
			tmp = a[0];
			a[0] = a[1];
			a[1] = tmp;
		}
		else {}
		// ?????§??¬?´???°????¨????
		for (size_t i = 1; i < a[0]; i++)
		{
			if (a[0] % i == 0 && a[1] % i == 0)
			{
				GCD = i;
			}
		}

		// ????°???¬?????°????¨????
		for (size_t i = a[0];; i++)
		{
			if (i % a[0] == 0 && i % a[1] == 0) {
				LCM = i;
				break;
			}
		}
		// ??????
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

C++: #import<bits/stdc++.h>
using namespace std;int a,b;main(){while(~scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),a/__gcd(a,b)*b);}

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

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

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

C++: #include <iostream>

using namespace std;

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

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<iostream>
#include<vector>
#include<algorithm>
#include<string>

#define add push_back
#define inf 2147000000

#define rep(i,n) for(int i=0;i<n;i++)
#define deb(a) cout<<a<<endl
#define out(a) cout<<a<<endl;

using namespace std;

int main(void){
	int a,b,bin;
	while(scanf("%d",&a)!=EOF){
		scanf("%d",&b);
	int aa=a,bb=b;
	if(a<b){
		swap(a,b);
	}
	
	while(b != 0){
		
		bin=a%b;
		a=b;
		b=bin;
	}
	
	out(a);
	out(aa+bb/a);
	}
}

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

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

int main(void){
    int a, b, tmp;
    if (a < b){
        tmp = b;
b = a;
a = tmp;

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

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

int main(void){
     long int n,m;
     long int c,e;
     long int l;
     cin >> n >> m;
     c = n;
     e = m;
     while(1){
	  if(c==e){
	       break;
	  }else if(c>e){
	       c = c-e;
	  }else if(c<e){
	       e = e-c;
	  }
     }
     l = (n*m)/c;
     cout << c << " " << l << endl;
     return 0;
}