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>
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<algorithm>
#include<cmath>
using namespace std;

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

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

int main() 
{    int a,b,m,n,r,t;
   
  while(scanf("%d%d",&a,&b)!=EOF)
{  
	if(a<b)
	{    t=b;
	     b=a;
		 a=t;
	}
	m=a;
	n=b;
	while((r=a%b)!=0)
	{   a=b;
	    b=r;
	}
	cout<<b<<" "<<m/b*n<<endl;

	
}
	return 0;
}

C++: #include <iostream>
using namespace std;
int GCD(int a,int b)
{
	if (a%b==0)
		return b;
	else
		return GCD(b,a%b);
}
int cmp(const void *a,const void *b)
{
	return *(int*)b-*(int*)a;
}
int main()
{
	int a[2],gcd,lcm;
	while(cin>>a[0]>>a[1])
	{
		if (cin.eof())break;
		qsort(a,2,sizeof(int),cmp);
		gcd=GCD(a[0],a[1]);
		lcm=(a[0]*a[1])/gcd;
		cout<<gcd<<' '<<lcm<<endl;
	}
	return 0;
}

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

int main() {
	// your code goes here
	long long a;
	long long b;
	long long r;
	long long gcd;
	long long lcm;
	while(cin>>a>>b){
		
		long long c=a;
		long long d=b;
		while(true){
		r=c%d;
		if(r==0){gcd=d; break;}
		c=d; d=r;
		
		}

	lcm= a*b / gcd;
	
	
	cout << gcd << " " << lcm << endl;	
	}
	return 0;
	
	
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a, b;
	while (cin >> a >> b){
		int gcd;
		int aa = max(a, b);
		int bb = min(a, b);
		while (true){
			if (aa % bb == 0) {
				gcd = bb;
				cout << gcd << ' ';
				goto C;
			}
			else{
				int tmp = aa - bb;
				aa = bb;
				bb = tmp;
			}
		}
	C:
		cout << a*b / gcd << endl;
	}
}

C++: #include<cstdio>
int g(int a,int b){return b?g(b,a%b):a;}
main(){int a,b;while(~scanf("%d%d",&a,&b))printf("%d %d\n",g(a,b),a/g(a,b)*b);}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
	long long a,b;
	while(cin>>a>>b){
	long long ta=a,tb=b;
	long long s=0,m=0;
	if(a<b)swap(a,b);
	while(true){
		int tmp=a;
		a=b;
		b=tmp%a;
		if(a%b==0){
			m=b;
			break;
		}
		if(a<b){
		//cout<<a<<" "<<b<<endl;
		m=1;
		break;
		}
	}
		s=(ta*tb)/m;
		cout<<m<<" "<<s<<endl;
	}
}

C++: #include<stdio.h>
#include<math.h>
 
int main(){
    unsigned int a,b;
    while(~scanf("%u%u",&a,&b)){
        unsigned int c=a,d=b;
        while(a>0&&b>0){
            if(a>b)a=a%b;
            else b=b%a;
        }
        printf("%u %u\n",a+b,c/(a+b)*d);
    }
}

C++: #include <iostream>

using namespace std;

void solve(long long a, long long b) {
	long long num = a * b;
	while (a != b) {
		if (a > b) {
			a -= b;
		}else if(b > a){
			b -= a;
		}

		if (a == b) {
			break;
		}
	}
	cout << a << " " << num / a << endl;
}

int main() {
	long long a, b;
	while (cin >> a >> b) {
		solve(a, b);
	}
	return 0;
}

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

int euclid(int, int);
int multiple(int, int);

int main(void){
  int a, b;
  while(cin >> a >> b){
    cout << euclid(a, b) << " " << multiple(a, b) << endl;
  }
  return 0;
}

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

  return b;
}

int multiple(int a, int b){
  int xa = a;
  int xb = b;
  while(xa != xb){
    if(xa < xb) xa += a;
    else xb += b;
  }

  return xa;
}

C++: #include <stdio.h>

int main (void){
	int a, b, i, j, breeeeak, c;
	while(scanf("%d%d", &a, &b)!=EOF){
		breeeeak=0;
		for(i=2;;i++){
			for(j=2;;j++){
				if(i*a<j*b){
					break;
				}
				if(i*a==j*b){
					breeeeak=1;
					c=i*a;
					break;
				}
			}
			if(breeeeak){break;}
		}
		
		printf("%d %d\n", a*b/c, c);
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int gcdfunk(long long int, long long int);

int main(){
  long long int a, b;
  int gcd[50], lcm[50];
  int i=0;
  while(1){
    cin >> a >> b;
    if(cin.eof()){
      break;
    }
    gcd[i]= gcdfunk(a, b);
    lcm[i]= (a*b)/ gcdfunk(a,b);
    i++;
  }
  for(int j=0;j<i;j++){
    cout << gcd[j] << " " << lcm[j] << endl;
  }
  return 0;
}

int gcdfunk(long long int x, long long int y){
  int z, work=0;
  if(x<y){
    work=x;
    x=y;
    y=work;
  }
  while(1){
    z=x%y;
    if(z==0){
      break;
    }else{
      x=y;
      y=z;
    }
  }
  return y;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;

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

int main(){
    int A,B;
	cin>>A>>B;
	printf("%d %d\n",gcd(A,B),A*B/gcd(A,B));
    return 0;
}

C++: 
#include <cstdio>

using namespace std;

long long gcd(long long a, long long b)
{
	if (a<b) {
		long long tmp = a; a = b; b = tmp;
	}
	long long tmp;
	while (b!=0) {
		tmp = b;
		b = a%b;
		a = tmp;
	}
	return a;
}


int main()
{
	//freopen("in.txt", "r", stdin);

	long long a, b;

	while (scanf("%lld%lld", &a, &b)==2) {
		long long v1 = gcd(a, b);
		long long v2 = a*b/v1;

		printf("%lld %lld\n", v1, v2);

	}

	return 0;
}