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 <bits/stdc++.h>
using namespace std;

long long int GCD(long long int a, long long int b) {
    return (b % a == 0) ? a : GCD(b % a, a);
}

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

int main() {
    long long int a, b;
    while (cin >> a >> b) {
        cout << GCD(a, b) << " " << LCM(a, b) << 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()
{
    int g;
    int n,m;
    int l;
    while(cin>>n>>m){
        if(n>=m)
            g=gcd(n,m);
        else
            g=gcd(m,n);
        l=g*(n/g)*(m/g);
        cout<<g<<" "<<l<<endl;
    }
    return 0;
}

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

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


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

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

int GCD(int x,int y) {
    if (x<y) {
        swap(x,y);
    }
    if (y==0) {
        return x;
    }
    return GCD(y,x%y);
}
int LCM(int x,int y) {
    return x*y/GCD(x,y);
}
int main() {
    int a, b;
    while (cin >> a >> b) {
        printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
    return 0;
}

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

C++: #include <iostream>

int main() {
	long long int a, b, t, ab, gcd, lcm;

	while (std::cin >> a >> b) {
		ab = a * b;
		while (a % b > 0) {
			t = a % b;
			a = b;
			b = t;
		}
		gcd = b;
		lcm = ab / gcd;
		std::cout << gcd << " " << lcm << std::endl;
	}

	return 0;
}

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

typedef long long ll;

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

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

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

C++: #include<stdio.h>
#include<string.h>

int GCD(int x,int y)
{
  if(y==0)
    return x;
  return GCD(y,x%y);
}

int LCM(int x,int y)
{
  return x * y / GCD(x,y);
}



int main(void)
{
  int a,b;
  while(scanf("%d %d",&a,&b) != EOF)
    {
      if(a<b){
	int k = b;
	b = a;
	a = k;
      }
      printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
}
#include<stdio.h>
#include<string.h>

int GCD(int x,int y)
{
  if(y==0)
    return x;
  return GCD(y,x%y);
}

int LCM(int x,int y)
{
  return x * y / GCD(x,y);
}



int main(void)
{
  int a,b;
  while(scanf("%d %d",&a,&b) != EOF)
    {
      if(a<b){
	int k = b;
	b = a;
	a = k;
      }
      printf("%d %d\n",GCD(a,b),LCM(a,b));
    }
}

C++: #include<iostream>


using namespace std;

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

int main(){
  
  long long a,b;
  cin>>a>>b;

  long long ans1 = gcd(a,b);
  cout<<ans1<<" "<<(a*b)/ans1<<endl;
  return 0;
}

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

int saidai(int a,int b){
	

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

int main(){
	int a,b,c,d;
	cin>>a;
	cin>>b;

	c=saidai(a,b);
	d=a*b/c;
	cout<<c<<" "<<d;
	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
int main()
{
    int a,b,s,d, l, k;
    while(scanf("%d%d",&a,&b)!=EOF){
    s=a;d=b;l=a;k=b;
    if(a>b){ while(b>0){if(a%b==0&&d%b==0) break; else b=b-1;} printf("%d ",b);}
    else { while(a>0){if(b%a==0&&s%a==0) break; else a=a-1;} printf("%d ",a);
}
    s=l;d=k;a=l;b=k;
    if(a>b){ while(b>0){if(a%b==0&&a%s==0) break; else a=a+1;} printf("%d\n",a);}
    else { while(a>0){if(b%a==0&&b%d==0) break; else b=b+1;} printf("%d\n",b);}
    }
    return 0;
}

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

C++: #include<iostream>
#include<cstdio>
using namespace std;
int gcd(int a,int b)
{
	if(a<b)
		{
			int temp;
			temp=b;
			b=a;
			a=temp;
		}
	if(a%b==0)
		return b;
	return gcd(b,a%b);
}
int lcm(int a,int b)
{
	int gcd1;
	gcd1=gcd(a,b);
	return (a/gcd1)*b;
}
int main()
{
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF)
		{
			cout<<gcd(a,b)<<" "<<lcm(a,b)<<"\n";	
		}
	return 0;
}

C++: #include <iostream>

using namespace std;

int calcGCD(int a, int b);

int main(void)
{
    int a,b;
    int GCD;
    int LCM;
    
    while (cin >> a >> b) {
        GCD = calcGCD(a, b);
        if (GCD == -1) {
            return -1;
        }
        
        LCM = a / GCD * b;
        cout << GCD << " " << LCM << endl;
    }
    
    return 0;
}

int calcGCD(int a, int b)
{
    while (a > 0 && b > 0) {
        if (a > b) {
            a %= b;
        } else {
            b %= a;
        }
    }
    
    if (a == 0) {
        return b;
    } else if (b == 0){
        return a;
    } else {
        return -1;
    }
}

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



int main() {

//変数の宣言

	long int a,b,temp;
	long int c[2];
	
	while(cin>>a>>b){
	
		c[0] = a;
		c[1] = b;
		
		if (c[0] < c[1]){
			temp = c[0];
			c[0] = c[1];
			c[1] = temp;
		}
		
		while(1){
			c[0] = c[0] % c[1];
			if (c[0]==0) break;
			temp = c[0];
			c[0] = c[1];
			c[1] = temp;
		}
		c[0] = a/c[1];
		c[0] = c[0]*b;
		
		cout << c[1] << " " << c[0] << endl;
	
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
ll gcd(ll m, ll n){
	while(m!=n)m>n?m-=n:n-=m;
	return m;
}
int main(){
	ll a,b;
	while(cin>>a>>b)cout<<gcd(a,b)<<' '<<a/gcd(a,b)*b<<endl;
}

C++: #include<iostream>

int gcd(int a, int b){
    while(int remainder = (a % b) != 0) {
        a = b;
        b = remainder;
    }
    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::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

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

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