#include<stdio.h>
int MCD(int,int);
int mcm(int, int);

int main() {
	int N, M, mcd, MCM;
	scanf("%d", &N);
	scanf("%d", &M);
	mcd=MCD(N, M);
	MCM=mcm(N, M);
	printf("%d\n", mcd);
	printf("%d\n", MCM);
	return 0;
}

int MCD(int n, int m) {
	int cont=1, mcd;
	while (cont<=n) {
		if(n%cont==0 && m%cont==0) {
		mcd=cont;
		}
	cont=cont+1;	
	}	
	return mcd;
}

int mcm(int n, int m) {
	int mcd, MCM;
	mcd=MCD(n, m);
	MCM=((n*m)/mcd);
	return MCM;
}
