Go: package main

import "fmt"

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

func LCM(a, b int) int {
	return a*b/GCM(a, b)
}

func main() {

	for {
		var a, b int
		var G, L int
		fmt.Scanf("%d %d", &a, &b)
		if a == 0 {
			break
		}
		G = GCM(a, b)
		L = LCM(a, b)
		fmt.Printf("%d %d", G, L)
	}
}

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

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

int main() {
    int a,b;
    while (cin>>a>>b) {
        if (a < b) {
            int tmp = a;
            a = b;
            b = tmp;
        }

        int gcd = get_gcd(a,b);

        int lcm = a / gcd * b;
        cout << gcd << " " << lcm << endl;

    }
    return 0;
}

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

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

using namespace std;

int main() {
    int a,b,a2,b2;
    int lcm,gcd;
    while(cin >> a >> b){
        a2=a;
        b2=b;
        while(a != b){
        if(a>b){a = a-b;}
        else{b=b-a;}
        }
        lcm = a;
        gcd=a2 / lcm * b2;
        cout << lcm << " " << gcd << endl;
    }

}

C++: /*#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <set>
#include <utility>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;

int main()
{
    //freopen("input.txt","r",stdin);
    return 0;
}
*/
/*
DLX解决9*9的数独??，?化?729*324的精?覆盖??
行：
一共9 * 9 * 9 == 729行。一共9 * 9小格，?一格有9?可能性(1 - 9)，?一?可能都??着一行。
列：
一共(9 + 9 + 9) * 9 + 81 == 324 ?前面三个9分?代表着9行9列和9小?，乘以9的意思是9?可能(1 - 9)，因???可能只可以??一个。
81代表着81个小格，限制着?一个小格只放一个数字。
?入数据后，如果?'.'，?建9行，即有1-9?可能，否?建一行，表示某小格只能放?定的某个数字。
*/
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int INF = 0x7fffffff;
const int NN = 350;
const int MM = 750;
#define N 9
int n,m;    //列，行
int cntc[NN];
int L[NN*MM],R[NN*MM],U[NN*MM],D[NN*MM];//?点的左?，右?，上?，下?
int C[NN*MM];
int head;
int mx[MM][NN];
int O[MM],idx;
int ans[10][10];

//?除列及其相?的行
void remove(int c)
{
    int i,j;
    L[R[c]] = L[c];
    R[L[c]] = R[c];
    for(i = D[c]; i != c; i = D[i])
    {
        for(j = R[i]; j != i; j = R[j])
        {
            U[D[j]] = U[j];
            D[U[j]] = D[j];
            cntc[C[j]]--;
        }
    }
}

//恢?列及其相?的行
void resume(int c)
{
    int i,j;
    R[L[c]] = c;
    L[R[c]] = c;
    for(i = D[c]; i != c; i = D[i])
    {
        for(j = R[i]; j != i; j = R[j])
        {
            U[D[j]] = j;
            D[U[j]] = j;
            cntc[C[j]]++;
        }
    }
}

bool dfs()
{
    int i,j,c;
    if(R[head] == head)
        return true;
    int min = INF;
    for(i = R[head]; i != head; i = R[i])
    {
        if(cntc[i] < min)
        {
            min = cntc[i];
            c = i;
        }
    }
    remove(c);
    for(i = D[c]; i != c; i = D[i])
    {
        //i是某点的序号，将?点所在行的行号保存
        O[idx++] = (i-1)/n;
        for(j = R[i]; j != i; j = R[j])
            remove(C[j]);
        if(dfs())
            return true;
        for(j = L[i]; j != i; j = L[j])
            resume(C[j]);
        idx--;
    }
    resume(c);
    return false;
}

bool build()
{
    int i,j,now,pre,first;
    idx = head = 0;
    for(i = 0; i < n; i++)
    {
        R[i] = i+1;
        L[i+1] = i;
    }
    R[n] = 0;
    L[0] = n;
    //列双向?表
    for(j = 1; j <= n; j++)
    {
        pre = j;
        cntc[j] = 0;
        for(i = 1; i <= m; i++)
        {
            if(mx[i][j])
            {
                cntc[j]++;//j的?数
                now = i*n+j;
                C[now] = j;//C?列指?
                D[pre] = now;
                U[now] = pre;
                pre = now;
            }
        }
        U[j] = pre;
        D[pre] = j;
        if(cntc[j] == 0)
            return false;
    }
    //行双向?表
    for(i = 1; i <= m; i++)
    {
        pre = first = -1;
        for(j = 1; j <= n; j++)
        {
            if(mx[i][j])
            {
                now = i*n+j;
                if(pre == -1)
                    first = now;
                else
                {
                    R[pre] = now;
                    L[now] = pre;
                }
                pre = now;
            }
        }
        if(first != -1)
        {
            R[pre] = first;
            L[first] = pre;
        }
    }
    return true;
}

int T;

void print()
{
    int i,j;
    int x,y,k;
    for(i = 0; i < idx; i++)
    {
        int r = O[i];
        k = r%9;
        if(k==0) k = 9;
        int num = (r - k)/9 + 1;
        y = num%9;
        if(y == 0) y = 9;
        x = (num-y)/9 + 1;
        ans[x][y] = k;
    }
    if(idx == 0)
        printf("impossible\n");
    else
    {
        for(i = 1; i <= 9; i++)
        {
            for(j = 1; j <= 9; j++)
                printf("%d",ans[i][j]);
        }
        cout<<endl;
    }
}

int map[MM][NN];
string str;
void readdata()
{
    char ch;
    int ind=0;
    for(int i = 1; i <= N; i++)
        for(int j = 1; j <= N; j++)
          {
            ch=str[ind++];
            if(ch=='.')
            map[i][j]=0;
            else
            map[i][j]=ch-'0';
          }
}
int main()
{
    //freopen("input.txt","r",stdin);
    int i,j,k;
    int cases;
    char cao[12];
    char s[12][12];
    while(1)
    {
        cin>>str;
        if(str=="end")break;
        memset(mx,0,sizeof(mx));
        readdata();
        for(i = 1; i <= 9; i++)
        {
            for(j = 1; j <= 9; j++)
             {
                int t = (i-1)*9 + j;
                if(map[i][j] == 0)
                {
                    for(k = 1; k <= 9; k++)
                    {
                        mx[9*(t-1)+k][t] = 1;               //81grid ?个小格只能放一个数字
                        mx[9*(t-1)+k][81+(i-1)*9+k] = 1;    //9row ?行数字k只能出?一次
                        mx[9*(t-1)+k][162+(j-1)*9+k] = 1;   //9col  ?列数字k只能出?一次
                        mx[9*(t-1)+k][243+((i-1)/3*3+(j+2)/3-1)*9+k] = 1;   //subgrid ?个3*3格子数字k只能出?一次
                    }
                }
                else
                {
                    k = map[i][j];
                    mx[9*(t-1)+k][t] = 1;               //81grid
                    mx[9*(t-1)+k][81+(i-1)*9+k] = 1;    //9row
                    mx[9*(t-1)+k][162+(j-1)*9+k] = 1;   //9col
                    mx[9*(t-1)+k][243+((i-1)/3*3+(j+2)/3-1)*9+k] = 1;   //subgrid
                }
            }
        }
        n = 324;
        m = 729;
        build();
        dfs();
        print();
    }
    return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;
const ll MOD = 1000000007;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

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

C++: #include <iostream>

unsigned long gcd(int a, int b);

int main(int argc, char** argv) {
	unsigned long a, b, g, l;
	double t;
	while(std::cin >> a >> b) {
		g = gcd(a, b);
    	t = (double)a / g;
	    l = (int)(b * t);
	    std::cout << gcd(a, b) << " " << l << std::endl;
	}
}

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