Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [100]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if x == 0 {
			break
		}
		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
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main(){
  long long int a,b;
  long long int temp,con;
  long long int hk1,hk2;
  while(scanf("%lld %lld",&a,&b)!=EOF){
    if(a>b){
      if(a%b==0){
	hk1=b;
      }else{
	long long int bit=b/2;
	for(long long int i=bit;i>0;i--){
	  if(a%i==0 && b%i==0){
	    hk1=i;
	    break;
	  }
	}
      }
    }else{
      if(b%a==0){
	hk1=a;
      }else{
	long long int dot=a/2;
	for(long long int i=dot;i>0;i--){
	  if(a%i==0 && b%i==0){
	    hk1=i;
	    break;
	  }
	}
      }
    }
    temp=a*b;
    con=temp/hk1;
    hk2=con;
    printf("%lld %lld\n",hk1,hk2);
  }
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

inline int gcd(int a, int b){
    int d_a = 0;
    while(!(a & 1)){ a >>= 1; ++d_a;}

    int d_b = 0;
    while(!(b & 1)){ b >>= 1; ++d_b;}

    while(a != b){
        if(a < b) swap(a, b);
        a -= b;
        do a >>= 1; while(!(a & 1));
    }

    return a << min(d_a, d_b);
}

int a, b;

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

C++: #include<iostream>
#include<stdio.h>
#include<algorithm>
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;
    long long b;
    while(scanf("%I64d%I64d",&a,&b)!=EOF)
    {
        printf("%I64d %I64d\n",gcd(a,b),(a/gcd(a,b))*b);
    }
return 0;
}

C++: #include<cstdio>
int main(void){
  int a0,a,b0,b,r;
  while(scanf("%d %d",&a,&b)!=EOF){
    b0=b;
    a0=a;
    r=a%b;
    while(r!=0){
      a=b;
      b=r;
      r=a%b;
    }
    printf("%d %d\n",b,(a0/b)*b0);
  }
  return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int n, m;
    while(scanf("%d%d", &n, &m) == 2) {
        printf("%d %d\n", __gcd(n, m), m / __gcd(n, m)*n);
    }
    return 0;
}

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

int main(){
//old
		/* 2014 ??????1
		int a[2],ans;
		cin >> a[0] >> a[1];
		ans = a[0] * a[1];
		cout << ans << endl;
		*/
		/* 2014 ??????2
		int a[6],ans = 0;
		cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
		if(a[0] + a[1] * 5 + a[2] * 10 + a[3] * 50 + a[4] * 100 + a[5] * 500 >= 1000) ans = 1;
		cout << ans << endl;
		*/
		/* 2014 ??????3
		int a,i = 0;
		cin >> a;
		int b[a],c[a],ans[a];
		while(a > i){
			cin >> b[i] >> c[i];
			ans[i] =  b[i] % c[i];
			if(ans[i] == 0) ans[i] = c[i];
			i++;
		}
		i = 0;
		while(a > i){
		cout << ans[i] << endl;
		i++;
		}
		*/
		/* 2014 ??????4
		int a[2],i = 1;
		cin >> a[0];
		int n[a[0]],m[a[0]];
		while (a[0] >= i){
			cin >> n[i] >> m[i];
			i++;
		}
		i = 1;
		cin >> a[1];
		int o[a[1]],p[a[1]];
		while (a[1] >= i){
			cin >> o[i] >> p[i];
			i++;
		}
		i = 1;
		int ii,c,aa;
		aa = a[0] + a[1];
		int ans[aa][2],hh[aa],mm[aa],chk,count = 1;
		while(aa >= i){
			ii = 1;
			chk = 1;
			if(a[0] >= i){
				while(i - 1 >= ii){
					if(n[i] == hh[ii] and m[i] == mm[ii]){
						chk = 0;
					}
					ii++;
				}
				if(chk == 1){ 
					hh[count] = n[i];
					mm[count] = m[i];
					count++;
				}
			}else{
				while(i - 1 >= ii){
					if(o[i - a[0]] == hh[ii] and p[i - a[0]] == mm[ii]){
						chk = 0;
					}
					ii++;
				}
				if(chk == 1){ 
					hh[count] = o[i - a[0]];
					mm[count] = p[i - a[0]];
					count++;
				}		

			}
			i++;
		}
		aa = count - 1;
		i = 1;
		while(aa >= i){
			ii = 1;
			c = 1;
				while(aa >= ii){
						if(hh[i] > hh[ii] or hh[i] == hh[ii] and mm[i] > mm[ii] and i != ii){
							c++;
						}
				ii++;
				}
			ans[c][0] = hh[i];
			ans[c][1] = mm[i];
		 i++;
		}
		i = 1;
		while(aa >= i){
			if(aa == i){
				if(ans[i][1] < 10){
					cout << ans[i][0] << ":" << "0" << ans[i][1] << endl;;
				}else{
					cout << ans[i][0] << ":" << ans[i][1] << endl;;
				}

			}else{
				if(ans[i][1] < 10){
					cout << ans[i][0] << ":" << "0" << ans[i][1] << " ";
				}else{
					cout << ans[i][0] << ":" << ans[i][1] << " ";
				}
			}
			i++;
		}
		//????????°???
		int n,i,ans = 100000,a,risi[2];
		cin >> n;
		for(i = 1;n >= i;i++){
			risi[0] =  ans * 0.05;
			risi[1] = risi[0];
			while(risi[1] >= 1000){risi[1] = risi[1] - 1000;}
				if(risi[1] > 0){risi[0] = risi[0] - risi[1] + 1000;}
			ans = ans + risi[0];
		}
		cout << ans << endl;
		*/
		/*int in,i[4];
		while(cin >> in){
		int ans = 0;
		for(i[0] = 0;9 >= i[0];i[0]++){
			//if(0 > in - i[0]) break;
			//cout << "[1]" <<  i[0] << endl;				
			for(i[1] = 0;9 >= i[1];i[1]++){
				//if(0 > in - ( i[0] + i[1] ) ) break;
				//cout << "[2]" << i[1] << endl;
				for(i[2] = 0;9 >= i[2];i[2]++){
					//if(0 > in - ( i[0] + i[1] + i[2] ) ) break;
					//cout << "[3]" << i[2] << endl;
					for(i[3] = 0;9 >= i[3];i[3]++){
						//if(0 > in - ( i[0] + i[1] + i[2] + i[3] ) ) break;
						//cout << "[4]" << i[3] << endl;
						//cout << "[1] " << i[0] << "  [2] " << i[1] << "  [3] " << i[2] << "  [4] " << i[3] << endl; 
						if(i[0] + i[1] + i[2] + i[3] == in){
						//cout << "[1] " << i[0] << "  [2] " << i[1] << "  [3] " << i[2] << "  [4] " << i[3] << endl; 
						ans++;
						}
					}	
				}
			}
		}
		cout << ans << endl;	
		}*/

		/*int in;
		cin >> in;
		int a[in];
		for(int i = 1;in >= i;i++){
			cout << "[IN] [" << i << "] ";
			cin >> a[i];
		}
		for(int i = 1;in >= i;i++){cout << "[OUT] ["<< i << "] " <<  a[i] << endl;}*/
//old;
		int a,b,GCD[2],OUTPUT[2],o[2];
		cin >> a >> b;
		GCD[0] = a;GCD[1] = b;
		o[0] = a / 1000000;
		while(GCD[0] != GCD[1]){
			if(GCD[0] > GCD[1]){
				GCD[0] = GCD[0] - GCD[1];
			}else if(GCD[1] > GCD[0]){
				GCD[1] = GCD[1] - GCD[0];
			}			
		}
		OUTPUT[0] = GCD[1];
		OUTPUT[1] = o[0] * b / OUTPUT[0];
		OUTPUT[1] = OUTPUT[1] * 1000000;
		cout << OUTPUT[0] << " " << OUTPUT[1] << endl;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define repp(i,n) for(int i=1; i<n; i++)
#define int long long
using namespace std;
int gcd(int a, int b)
{
    if (a % b == 0) return b;
    return gcd(b, a % b);
}
signed main(){
  int n,m;
  while(cin >> n >> m){
    int a = gcd(n,m);
    int b = n*m/a;
    cout << a << " " << b << endl;
  }
  return 0;
}