Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

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

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

int main(){
	int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(true){
		if(a==0||b==0)break;
		int tmp=a;
		a=b;
		b=tmp%a;
		if(a<b){
		b=1;
		break;
		}
		if(a%b==0)break;
	}
	if(a==0)a=1;
	if(b==0)b=1;
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int main(){
	long long int x, y;
	while (cin >> x >> y) {
		long long int a, b, c;
		a = max(x, y);
		b = min(x, y);
		c = a % b;
		while (c) {
			a = b;
			b = c;
			c = a % b;
		}
		cout << b << ' ' << x * y / b << endl;
	}
	return 0;
}

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

int main(){
	int  a,b,ta,tb;
	
	while(cin>>a>>b){
	ta=a;tb=b;
	if(a<b)swap(a,b);
	while(true){
		int tmp=a;
		a=b;
		if(a!=0)b=tmp%a;
		if(a<b){
		b=1;
		break;
		}
		if(a%b==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: /*
  GCD and LCM
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;

int n,m;

int gi() {
  int x=0,o=1; char ch=getchar();
  while(ch!='-' && (ch<'0' || ch>'9')) ch=getchar();
  if(ch=='-') o=-1,ch=getchar();
  while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return o*x;
}

int gcd(int x, int y) {
  return y?gcd(y,x%y):x;
}

int main() {
  while(scanf("%d%d", &n, &m)!=EOF) {
    int g=gcd(n,m);
    printf("%d %d\n", g,n/g*m);
  }
  return 0;
}

C++: #include<stdio.h>
int main(){

	long long int a,b,x,y;
	while(~scanf("%lld%lld",&a,&b))
	{
	x=a;
	y=b;
	while(a!=b){
		if(a>b){
			a-=b;
		}
		else{
			b-=a;
		}
	}
	printf("%lld %lld",a,x/a*y);
}	
return 0;
	}

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

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

C++: #include<iostream>
using namespace std;
int gcd(int a,int b)
{
	return a==b?a:gcd(b,a%b);
}
int main()
{
	int a,b,d;
	cin>>a>>b;
	d=gcd(a,b);
	cout<<d<<" "<<a/d*b;
	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(){
	int a, b;
	while((scanf("%d%d",&a,&b))!=EOF){
		int c=gcd(a, b);
		int d=(a/c)*b;
		printf("%d %d\n",c,d);
	}
}

C++: #include <iostream>
using namespace std;
 
int gcd(int a, int b){
    if(b > 0){
        return gcd(b, a % b);
    }else{
        return 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;
    }
}

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

long GCD(long, long);
long LCM(long, long);

long gcd, lcm;

int main(){
	long a, b;
	while(cin >> a >> b){
		if(a < b)
			swap(a, b); // a > b
		gcd = GCD(a, b);
		lcm = LCM(a, b);
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

long GCD(long a, long b){
	if(b == 0)
		return a;
	else
		return GCD(b, a%b);
}

long LCM(long a, long b){
	return a*b/gcd;
}

C++: #include <cstdio>
#define llong long long

int main() {
  llong a,b;
  while(scanf("%lld %lld", &a, &b) != EOF) {
    llong lcm = a*b;
    while(a != 0 && b != 0) {
      if(a >= b) a = a%b;
      else b = b%a;
    }
    llong gcd = a+b;
    lcm /= gcd;
    printf("%lld %lld\n", gcd, lcm);
  }
  return 0;
}

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


int main(){
	int a, b, tmp, x, y, z;
	while (true){
		cin >> a >> b;
		if (cin.eof()){
			break;
		}
		if (a < b){
			 tmp = a;
			 x = b;
		}
		else {
			x = a;
			tmp = b;
		}
		while (tmp != 0) {
			y = tmp;
			tmp = x % y;
			x = y;
		}
		z = a / y * b;
		cout << to_string(y) << " " << to_string(z) << endl;
	}
	return 0;
}

C++: #include <cstdio>
int main(){
	long a,b,x,y;
	while (~scanf("%ld%ld", &a, &b)) {
		for(x=a,y=b; x%=y; x^=y^=x^=y);
		printf("%ld %ld\n", y, a*b/y);
	}
}

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

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	long long int a = 0;
	long long int b = 0;
	while (cin >> a, cin >> b)
	{
		long long int c = 0;
		long long int d = 0;
		long long int e = 0;
		c = a;
		d = b;
		if (c < d)
		{
			long long int i = 0;
			i = d;
			d = c;
			c = i;
		}
		while (1)
		{
			e = c % d;
			if (e == 0)
			{
				break;
			}
			c = d;
			d = e;
		}
		cout << d << " " << a / d * b << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int gcd(int a, int b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a%b);
}

int main(void) {
	long long p, q, r;
	while (cin >> p >> q) {
		if (p < q) {
			swap(p, q);
		}
		r = gcd(p, q);
		cout << r << ' ' << p*q / r << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
long long gcm(long long a, long long b){
	if(b > a){
	long long d;
	d = a;
	a = b;
	b = d;
	}	
	long long c;
	while(b!=0){
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}
int main(){
	for(int i=1;i<=10;i++){
	long long c,d,e;
	std::cin>>c>>d;
	e = gcm(c,d);
	std::cout<<e<<" "<<((c/e)*(d/e)*e)<<endl;
	}
}