#include<iostream>
#include<string>
using namespace std;

unsigned int yaku( unsigned int x, unsigned int y ){
	while( x != y ){
		if( x > y )			x -= y;
		else if( x < y )	y -= x;
	}
	return x;
}

unsigned int bai( unsigned int x, unsigned int y ){
	unsigned int x0=x, y0=y;
	while( x != y ){
		if( x > y )			y += y0;
		else if( x < y )	x += x0;
	}
	return x;
}

int main(){
	unsigned int a, b;
	string line;
	while(1){
		getline( cin, line );
		sscanf( line.c_str(), "%d %d", &a, &b );
		if( line.size() == 0 ){
			break;
		}

		unsigned int max = yaku( a, b );
		unsigned int min = bai( a, b );
		cout << max << " " << min << endl;
	}
}