import java.util.ArrayList;
import java.util.Scanner;

class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	
    	int a;
    	int b;
    	while (scan.hasNextInt()){
    		a = scan.nextInt();
    		b = scan.nextInt();
    		int[] result = doThem(a, b);
    		System.out.println(result[0] + " " + result[1]);
    	}
    }
    
    public static int[] doThem(int a, int b){
    	ArrayList<Integer> comfac = new ArrayList<Integer>();
		
		while (!isprime(a) || !isprime(b)){
			
			int fac;
			if (minfactor(a) == minfactor(b)){
				fac = minfactor(a);
				a = a / fac;
				b = b / fac;
				comfac.add(fac);
			}else if(minfactor(a) < minfactor(b)){
				fac = minfactor(b);
				if(a % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}else if(minfactor(a) > minfactor(b)){
				fac = minfactor(a);
				if(b % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}
		}
		
		if(a == b){
			a = a / a;
			b = b / a;
			comfac.add(a);
		}
		
		int[] result = new int[2];
		result[0] = 1; result[1] = 1;
		for(Integer value : comfac){
			result[0] = result[0] * value;
		}
		result[1] = result[0]*a*b;
		return result;
    }
    
    public static int minfactor(int n){
    	if (n % 2 == 0) return 2;
    	if (n % 3 == 0) return 3;
    	if (n % 5 == 0) return 5;
    	
    	int m = 7;
    	while (m*m <= n){
    		if (m*m == n){
    			return m;
    		}
    		m += 2;
    	}
    	
    	return n;
    }
    
    public static boolean isprime(int n){
    	if(minfactor(n) == n){
    		return true;
    	}else{
    		return false;
    	}
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	
    	int a;
    	int b;
    	while (scan.hasNextInt()){
    		a = scan.nextInt();
    		b = scan.nextInt();
    		int[] result = doThem(a, b);
    		System.out.println(result[0] + " " + result[1]);
    	}
    }
    
    public static int[] doThem(int a, int b){
    	ArrayList<Integer> comfac = new ArrayList<Integer>();
		
		while (!isprime(a) || !isprime(b)){
			
			int fac;
			if (minfactor(a) == minfactor(b)){
				fac = minfactor(a);
				a = a / fac;
				b = b / fac;
				comfac.add(fac);
			}else if(minfactor(a) < minfactor(b)){
				fac = minfactor(b);
				if(a % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}else if(minfactor(a) > minfactor(b)){
				fac = minfactor(a);
				if(b % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}
		}
		
		if(a == b){
			a = a / a;
			b = b / a;
			comfac.add(a);
		}
		
		int[] result = new int[2];
		result[0] = 1; result[1] = 1;
		for(Integer value : comfac){
			result[0] = result[0] * value;
		}
		result[1] = result[0]*a*b;
		return result;
    }
    
    public static int minfactor(int n){
    	if (n % 2 == 0) return 2;
    	if (n % 3 == 0) return 3;
    	if (n % 5 == 0) return 5;
    	
    	int m = 7;
    	while (m*m <= n){
    		if (m*m == n){
    			return m;
    		}
    		m += 2;
    	}
    	
    	return n;
    }
    
    public static boolean isprime(int n){
    	if(minfactor(n) == n){
    		return true;
    	}else{
    		return false;
    	}
    }
} Main public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	
    	int a;
    	int b;
    	while (scan.hasNextInt()){
    		a = scan.nextInt();
    		b = scan.nextInt();
    		int[] result = doThem(a, b);
    		System.out.println(result[0] + " " + result[1]);
    	}
    } main {
    	Scanner scan = new Scanner(System.in);
    	
    	int a;
    	int b;
    	while (scan.hasNextInt()){
    		a = scan.nextInt();
    		b = scan.nextInt();
    		int[] result = doThem(a, b);
    		System.out.println(result[0] + " " + result[1]);
    	}
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int a; a int b; b while (scan.hasNextInt()){
    		a = scan.nextInt();
    		b = scan.nextInt();
    		int[] result = doThem(a, b);
    		System.out.println(result[0] + " " + result[1]);
    	} scan.hasNextInt() scan.hasNextInt scan {
    		a = scan.nextInt();
    		b = scan.nextInt();
    		int[] result = doThem(a, b);
    		System.out.println(result[0] + " " + result[1]);
    	} a = scan.nextInt() a scan.nextInt() scan.nextInt scan b = scan.nextInt() b scan.nextInt() scan.nextInt scan int[] result = doThem(a, b); result doThem(a, b) doThem a b System.out.println(result[0] + " " + result[1]) System.out.println System.out System System.out result[0] + " " + result[1] result[0] + " " + result[1] result[0] result 0 " " result[1] result 1 String[] args args public static int[] doThem(int a, int b){
    	ArrayList<Integer> comfac = new ArrayList<Integer>();
		
		while (!isprime(a) || !isprime(b)){
			
			int fac;
			if (minfactor(a) == minfactor(b)){
				fac = minfactor(a);
				a = a / fac;
				b = b / fac;
				comfac.add(fac);
			}else if(minfactor(a) < minfactor(b)){
				fac = minfactor(b);
				if(a % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}else if(minfactor(a) > minfactor(b)){
				fac = minfactor(a);
				if(b % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}
		}
		
		if(a == b){
			a = a / a;
			b = b / a;
			comfac.add(a);
		}
		
		int[] result = new int[2];
		result[0] = 1; result[1] = 1;
		for(Integer value : comfac){
			result[0] = result[0] * value;
		}
		result[1] = result[0]*a*b;
		return result;
    } doThem {
    	ArrayList<Integer> comfac = new ArrayList<Integer>();
		
		while (!isprime(a) || !isprime(b)){
			
			int fac;
			if (minfactor(a) == minfactor(b)){
				fac = minfactor(a);
				a = a / fac;
				b = b / fac;
				comfac.add(fac);
			}else if(minfactor(a) < minfactor(b)){
				fac = minfactor(b);
				if(a % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}else if(minfactor(a) > minfactor(b)){
				fac = minfactor(a);
				if(b % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}
		}
		
		if(a == b){
			a = a / a;
			b = b / a;
			comfac.add(a);
		}
		
		int[] result = new int[2];
		result[0] = 1; result[1] = 1;
		for(Integer value : comfac){
			result[0] = result[0] * value;
		}
		result[1] = result[0]*a*b;
		return result;
    } ArrayList<Integer> comfac = new ArrayList<Integer>(); comfac new ArrayList<Integer>() while (!isprime(a) || !isprime(b)){
			
			int fac;
			if (minfactor(a) == minfactor(b)){
				fac = minfactor(a);
				a = a / fac;
				b = b / fac;
				comfac.add(fac);
			}else if(minfactor(a) < minfactor(b)){
				fac = minfactor(b);
				if(a % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}else if(minfactor(a) > minfactor(b)){
				fac = minfactor(a);
				if(b % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}
		} !isprime(a) || !isprime(b) !isprime(a) isprime(a) isprime a !isprime(b) isprime(b) isprime b {
			
			int fac;
			if (minfactor(a) == minfactor(b)){
				fac = minfactor(a);
				a = a / fac;
				b = b / fac;
				comfac.add(fac);
			}else if(minfactor(a) < minfactor(b)){
				fac = minfactor(b);
				if(a % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}else if(minfactor(a) > minfactor(b)){
				fac = minfactor(a);
				if(b % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}
		} int fac; fac if (minfactor(a) == minfactor(b)){
				fac = minfactor(a);
				a = a / fac;
				b = b / fac;
				comfac.add(fac);
			}else if(minfactor(a) < minfactor(b)){
				fac = minfactor(b);
				if(a % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}else if(minfactor(a) > minfactor(b)){
				fac = minfactor(a);
				if(b % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			} minfactor(a) == minfactor(b) minfactor(a) minfactor a minfactor(b) minfactor b {
				fac = minfactor(a);
				a = a / fac;
				b = b / fac;
				comfac.add(fac);
			} fac = minfactor(a) fac minfactor(a) minfactor a a = a / fac a a / fac a fac b = b / fac b b / fac b fac comfac.add(fac) comfac.add comfac fac if(minfactor(a) < minfactor(b)){
				fac = minfactor(b);
				if(a % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}else if(minfactor(a) > minfactor(b)){
				fac = minfactor(a);
				if(b % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			} minfactor(a) < minfactor(b) minfactor(a) minfactor a minfactor(b) minfactor b {
				fac = minfactor(b);
				if(a % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			} fac = minfactor(b) fac minfactor(b) minfactor b if(a % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				} a % fac == 0 a % fac a fac 0 {
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				} a = a / fac a a / fac a fac b = b / fac b b / fac b fac comfac.add(fac) comfac.add comfac fac {
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				} fac = 5 fac 5 if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					} a % fac == 0 && b % 5 == 0 a % fac == 0 a % fac a fac 0 b % 5 == 0 b % 5 b 5 0 {
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					} a = a / fac a a / fac a fac b = b / fac b b / fac b fac comfac.add(fac) comfac.add comfac fac {
						break;
					} break; if(minfactor(a) > minfactor(b)){
				fac = minfactor(a);
				if(b % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			} minfactor(a) > minfactor(b) minfactor(a) minfactor a minfactor(b) minfactor b {
				fac = minfactor(a);
				if(b % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			} fac = minfactor(a) fac minfactor(a) minfactor a if(b % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				} b % fac == 0 b % fac b fac 0 {
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				} a = a / fac a a / fac a fac b = b / fac b b / fac b fac comfac.add(fac) comfac.add comfac fac {
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				} fac = 5 fac 5 if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					} a % fac == 0 && b % 5 == 0 a % fac == 0 a % fac a fac 0 b % 5 == 0 b % 5 b 5 0 {
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					} a = a / fac a a / fac a fac b = b / fac b b / fac b fac comfac.add(fac) comfac.add comfac fac {
						break;
					} break; if(a == b){
			a = a / a;
			b = b / a;
			comfac.add(a);
		} a == b a b {
			a = a / a;
			b = b / a;
			comfac.add(a);
		} a = a / a a a / a a a b = b / a b b / a b a comfac.add(a) comfac.add comfac a int[] result = new int[2]; result new int[2] 2 result[0] = 1 result[0] result 0 1 result[1] = 1 result[1] result 1 1 for(Integer value : comfac){
			result[0] = result[0] * value;
		} Integer value comfac {
			result[0] = result[0] * value;
		} {
			result[0] = result[0] * value;
		} result[0] = result[0] * value result[0] result 0 result[0] * value result[0] result 0 value result[1] = result[0]*a*b result[1] result 1 result[0]*a*b result[0]*a*b result[0] result 0 a b return result; result int a a int b b public static int minfactor(int n){
    	if (n % 2 == 0) return 2;
    	if (n % 3 == 0) return 3;
    	if (n % 5 == 0) return 5;
    	
    	int m = 7;
    	while (m*m <= n){
    		if (m*m == n){
    			return m;
    		}
    		m += 2;
    	}
    	
    	return n;
    } minfactor {
    	if (n % 2 == 0) return 2;
    	if (n % 3 == 0) return 3;
    	if (n % 5 == 0) return 5;
    	
    	int m = 7;
    	while (m*m <= n){
    		if (m*m == n){
    			return m;
    		}
    		m += 2;
    	}
    	
    	return n;
    } if (n % 2 == 0) return 2; n % 2 == 0 n % 2 n 2 0 return 2; 2 if (n % 3 == 0) return 3; n % 3 == 0 n % 3 n 3 0 return 3; 3 if (n % 5 == 0) return 5; n % 5 == 0 n % 5 n 5 0 return 5; 5 int m = 7; m 7 while (m*m <= n){
    		if (m*m == n){
    			return m;
    		}
    		m += 2;
    	} m*m <= n m*m m m n {
    		if (m*m == n){
    			return m;
    		}
    		m += 2;
    	} if (m*m == n){
    			return m;
    		} m*m == n m*m m m n {
    			return m;
    		} return m; m m += 2 m 2 return n; n int n n public static boolean isprime(int n){
    	if(minfactor(n) == n){
    		return true;
    	}else{
    		return false;
    	}
    } isprime {
    	if(minfactor(n) == n){
    		return true;
    	}else{
    		return false;
    	}
    } if(minfactor(n) == n){
    		return true;
    	}else{
    		return false;
    	} minfactor(n) == n minfactor(n) minfactor n n {
    		return true;
    	} return true; true {
    		return false;
    	} return false; false int n n
import java.util.ArrayList;
import java.util.Scanner;

class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	
    	int a;
    	int b;
    	while (scan.hasNextInt()){
    		a = scan.nextInt();
    		b = scan.nextInt();
    		int[] result = doThem(a, b);
    		System.out.println(result[0] + " " + result[1]);
    	}
    }
    
    public static int[] doThem(int a, int b){
    	ArrayList<Integer> comfac = new ArrayList<Integer>();
		
		while (!isprime(a) || !isprime(b)){
			
			int fac;
			if (minfactor(a) == minfactor(b)){
				fac = minfactor(a);
				a = a / fac;
				b = b / fac;
				comfac.add(fac);
			}else if(minfactor(a) < minfactor(b)){
				fac = minfactor(b);
				if(a % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}else if(minfactor(a) > minfactor(b)){
				fac = minfactor(a);
				if(b % fac == 0){
					a = a / fac;
					b = b / fac;
					comfac.add(fac);
				}else{
					fac = 5;
					if(a % fac == 0 && b % 5 == 0){
						a = a / fac;
						b = b / fac;
						comfac.add(fac);
					}else{
						break;
					}
				}
			}
		}
		
		if(a == b){
			a = a / a;
			b = b / a;
			comfac.add(a);
		}
		
		int[] result = new int[2];
		result[0] = 1; result[1] = 1;
		for(Integer value : comfac){
			result[0] = result[0] * value;
		}
		result[1] = result[0]*a*b;
		return result;
    }
    
    public static int minfactor(int n){
    	if (n % 2 == 0) return 2;
    	if (n % 3 == 0) return 3;
    	if (n % 5 == 0) return 5;
    	
    	int m = 7;
    	while (m*m <= n){
    		if (m*m == n){
    			return m;
    		}
    		m += 2;
    	}
    	
    	return n;
    }
    
    public static boolean isprime(int n){
    	if(minfactor(n) == n){
    		return true;
    	}else{
    		return false;
    	}
    }
}