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() {
		x, y := nextInts()
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		fmt.Fprintf(out, "%d %d\n", y, lcm/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
}

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

long long GCD (long long a, long long b)
{
    /*long long t;
    if (a>b) swap(a,b);
    while (1)
    {
        t=b%a;
        if (t==0) break;
        b=a;
        a=t;
    }
    return a;*/
    if (a%b==0) return b;
    else if (b%a==0) return a;
    else if (a>b) return GCD(a%b,b);
    else return GCD(b%a,a);
}

int main()
{
    long long a,b,gcd[50],lcm[50],c=0;
    while (cin>>a>>b)
    {
        gcd[c]=GCD(a,b);
        lcm[c]=a*b/gcd[c];
        c++;
    }
    for (int i=0; i<c; i++) cout<<gcd[i]<<" "<<lcm[i]<<'\n';
    return 0;
}

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

int gcd(int a, int b){

int p,q,r;

if(a<b){p=b;b=a;a=p;

}

   while((r=b%a)!=0){
  q=b/a;
  b=a;
  a=r;
  }
  return a;
  
}

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<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

//typedef int kz;
//typedef long kz;
typedef long long kz;

kz gcd(kz a,kz b) { if(b==0) return a; else gcd(b,a%b); }
kz lcm(kz a,kz b) { return a*b/gcd(a,b); }

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 **/


int main(){
    int mod=1000000007;
    int a,b;
    while ((scanf("%d %d",&a,&b))!=EOF) {
        printf("%d %d\n",gcd(max(a,b),min(a,b)),lcm(max(a,b),min(a,b)));
    }
    return 0;
}

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

C++: #include "iostream"
using namespace std;

char a[20][20];

int main()
{
	int w,h;
	int b,c;
	
	int z=0;
	while(1)
	{
		int i,j;
		cin>>w>>h;
		if(w==0&&h==0)break;
		for(i=0;i<w;i++)
			for(j=0;j<h;j++)
			{
				cin>>a[i][j];
				if(a[i][j]=='@')
				{
					b=i;
					c=j;
				}
			}
			for(i=b;i<w;i++)
				for(j=c;j<h;j++)
				{
					if(a[i][j]!='@'&&a[i][j]!='#'&&(a[i-1][j]=='@'||a[i][j-1]=='@'))
					{
						a[i][j]='@';
						z++;
						
					}
				}
				for(i=b;i<w;i++)
					for(j=c;j>=0;j--)
					{
						if(a[i][j]!='@'&&a[i][j]!='#'&&(a[i-1][j]=='@'||a[i][j+1]=='@'))
						{
							a[i][j]='@';
							z++;
						}
					}
				for(i=b;i>=0;i--)
					for(j=c;j>=0;j--)
					{
						if(a[i][j]!='@'&&a[i][j]!='#'&&(a[i+1][j]=='@'||a[i][j+1]=='@'))
						{
							a[i][j]='@';
						    z++;
						}
					}
				for(i=b;i>=0;i--)
					for(j=c;j<h;j++)
					{
						if(a[i][j]!='@'&&a[i][j]!='#'&&(a[i][j-1]=='@'||a[i+1][j]=='@'))
						{
							a[i][j]='@';
							z++;
						}
					}
					
					cout<<z<<endl;
    
	}
	return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
	
int gcd(int a, int b){
	int c;
	if (a < b) {
		a+=b; b=a-b; a-=b;
	}
	while (b != 0) {
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}
int lcm(int x, int y)
{
    return (x * y / gcd(x, y));
}


int main(void)
{
	int a, b;
	scanf("%d %d", &a, &b);
	printf("%d %d\n", gcd(a, b),lcm(a,b));
	return 0;
	
}

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
typedef long long ll;
int main(void) {
    ll a, b, A, B;
    while (cin >> a >> b) {
        A = a; B = b;
        if (a < b) swap(a, b);
        ll r = b;
        while (r) {
            r = a % b;
            a = b;
            b = r;
        }
        cout << a << " " << (A/a) * B << endl;
    }
    return 0;
}

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

int main(){
	long long a, b;
	long long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a / y * b) << endl;
	}
}

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;
		b=tmp-b;
		if(b==1){
		b=1;
		break;
		}
		if(a-b==0)break;
	}
	cout<<b<<" "<<ta*tb/b<<endl;
	}
	return 0;
}

C++: #include <cstdio>


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

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

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

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

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

int main() {
  long a, b; 

  while(cin >> a >> b) {

    cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
  }
}

C++: #include <cstdio>

int main()
{
        unsigned long a, b;

        while (scanf("%lu %lu", &a, &b)) {
                unsigned long max = (a > b) ? a : b,
                                          min = (a < b) ? a : b;
                while (min) {
                        int r = max % min;
                        max = min;
                        min = r;
                }
                unsigned long lcm = a * b / max;
                printf("%lu %lu\n", max, lcm);
        }

        return 0;
}

C++: //
//  main.cpp
//  b
//
//  Created by h3037178 on 2017/07/31.
//  Copyright ?? 2017??´ ?????£?????????. All rights reserved.
//

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main(){
    long long a,b,s,d;
    while(cin>>a>>b){
        for(int o=20000000;o>0;o--){
            if(a>=20000000||b>=20000000){
                break;
            }
            if(a%o==0&&b%o==0){
                s=o;
                 d=a*b/s;
                cout<<s<<" "<<d<<endl;
                break;
            }
        }
    }
}

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

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;
}