import java.util.Scanner;
import java.math.*;
public class Main {
	public static void main(String[]args){
		Scanner s =new Scanner(System.in);
		while(s.hasNext()){
			int a =s.nextInt();
			int b =s.nextInt();
			int[] y =yakusu(a);
			int[] z =yakusu(b);
			int n[]=kobaisu(z,y);
			System.out.println(Integer.toString(n[1])+" "+Integer.toString(n[0]));
		}
	}
	public static int[] yakusu(int a){
		int[] l =new int[(int)Math.sqrt((double)a)+1];
		int counta=0;
		for(int i=2;i<=a;i++){
			if(a%i==0){
				l[counta]=i;
				counta++;
				a=a/i;
				i--;
			}
		}
		int[] y=new int[counta];
		for(int j=0;j<counta;j++){
			y[j]=l[j];
		}
		return y;
	}
	
	public static boolean sosu(int a){
		for(int j=2;j<=a;j++){
			if(a==j){
				return true;
			}else if(a%j==0)return false;
		}
		return false;
	}
	public static int[] kobaisu(int[] a,int[] b){
		int[] n= {1,1};
		int j=0,i=0;
		
		while(i<a.length&&j<b.length){
			if(a[i]==b[j]){
				n[0]=n[0]*a[i];
				n[1]=n[1]*a[i];
				i++;j++;
			}else if(a[i]>b[j]){
				n[0]=n[0]*b[j];
				j++;		
			}else if(a[i]<b[j]){
				n[0]=n[0]*a[i];
				i++;
			}
		}
		while(i<a.length){
			n[0]=n[0]*a[i];
			i++;
		}
		while(j<b.length){
			n[0]=n[0]*b[j];
			j++;
		}
		return n;
	}
} import java.util.Scanner; Scanner java.util import java.math.*; math.* java public class Main {
	public static void main(String[]args){
		Scanner s =new Scanner(System.in);
		while(s.hasNext()){
			int a =s.nextInt();
			int b =s.nextInt();
			int[] y =yakusu(a);
			int[] z =yakusu(b);
			int n[]=kobaisu(z,y);
			System.out.println(Integer.toString(n[1])+" "+Integer.toString(n[0]));
		}
	}
	public static int[] yakusu(int a){
		int[] l =new int[(int)Math.sqrt((double)a)+1];
		int counta=0;
		for(int i=2;i<=a;i++){
			if(a%i==0){
				l[counta]=i;
				counta++;
				a=a/i;
				i--;
			}
		}
		int[] y=new int[counta];
		for(int j=0;j<counta;j++){
			y[j]=l[j];
		}
		return y;
	}
	
	public static boolean sosu(int a){
		for(int j=2;j<=a;j++){
			if(a==j){
				return true;
			}else if(a%j==0)return false;
		}
		return false;
	}
	public static int[] kobaisu(int[] a,int[] b){
		int[] n= {1,1};
		int j=0,i=0;
		
		while(i<a.length&&j<b.length){
			if(a[i]==b[j]){
				n[0]=n[0]*a[i];
				n[1]=n[1]*a[i];
				i++;j++;
			}else if(a[i]>b[j]){
				n[0]=n[0]*b[j];
				j++;		
			}else if(a[i]<b[j]){
				n[0]=n[0]*a[i];
				i++;
			}
		}
		while(i<a.length){
			n[0]=n[0]*a[i];
			i++;
		}
		while(j<b.length){
			n[0]=n[0]*b[j];
			j++;
		}
		return n;
	}
} Main public static void main(String[]args){
		Scanner s =new Scanner(System.in);
		while(s.hasNext()){
			int a =s.nextInt();
			int b =s.nextInt();
			int[] y =yakusu(a);
			int[] z =yakusu(b);
			int n[]=kobaisu(z,y);
			System.out.println(Integer.toString(n[1])+" "+Integer.toString(n[0]));
		}
	} main {
		Scanner s =new Scanner(System.in);
		while(s.hasNext()){
			int a =s.nextInt();
			int b =s.nextInt();
			int[] y =yakusu(a);
			int[] z =yakusu(b);
			int n[]=kobaisu(z,y);
			System.out.println(Integer.toString(n[1])+" "+Integer.toString(n[0]));
		}
	} Scanner s =new Scanner(System.in); s new Scanner(System.in) while(s.hasNext()){
			int a =s.nextInt();
			int b =s.nextInt();
			int[] y =yakusu(a);
			int[] z =yakusu(b);
			int n[]=kobaisu(z,y);
			System.out.println(Integer.toString(n[1])+" "+Integer.toString(n[0]));
		} s.hasNext() s.hasNext s {
			int a =s.nextInt();
			int b =s.nextInt();
			int[] y =yakusu(a);
			int[] z =yakusu(b);
			int n[]=kobaisu(z,y);
			System.out.println(Integer.toString(n[1])+" "+Integer.toString(n[0]));
		} int a =s.nextInt(); a s.nextInt() s.nextInt s int b =s.nextInt(); b s.nextInt() s.nextInt s int[] y =yakusu(a); y yakusu(a) yakusu a int[] z =yakusu(b); z yakusu(b) yakusu b int n[]=kobaisu(z,y); n kobaisu(z,y) kobaisu z y System.out.println(Integer.toString(n[1])+" "+Integer.toString(n[0])) System.out.println System.out System System.out Integer.toString(n[1])+" "+Integer.toString(n[0]) Integer.toString(n[1])+" "+Integer.toString(n[0]) Integer.toString(n[1]) Integer.toString Integer n[1] n 1 " " Integer.toString(n[0]) Integer.toString Integer n[0] n 0 String[]args args public static int[] yakusu(int a){
		int[] l =new int[(int)Math.sqrt((double)a)+1];
		int counta=0;
		for(int i=2;i<=a;i++){
			if(a%i==0){
				l[counta]=i;
				counta++;
				a=a/i;
				i--;
			}
		}
		int[] y=new int[counta];
		for(int j=0;j<counta;j++){
			y[j]=l[j];
		}
		return y;
	} yakusu {
		int[] l =new int[(int)Math.sqrt((double)a)+1];
		int counta=0;
		for(int i=2;i<=a;i++){
			if(a%i==0){
				l[counta]=i;
				counta++;
				a=a/i;
				i--;
			}
		}
		int[] y=new int[counta];
		for(int j=0;j<counta;j++){
			y[j]=l[j];
		}
		return y;
	} int[] l =new int[(int)Math.sqrt((double)a)+1]; l new int[(int)Math.sqrt((double)a)+1] (int)Math.sqrt((double)a)+1 (int)Math.sqrt((double)a) Math.sqrt Math (double)a 1 int counta=0; counta 0 for(int i=2;i<=a;i++){
			if(a%i==0){
				l[counta]=i;
				counta++;
				a=a/i;
				i--;
			}
		} int i=2; int i=2; i 2 i<=a i a i++ i++ i {
			if(a%i==0){
				l[counta]=i;
				counta++;
				a=a/i;
				i--;
			}
		} {
			if(a%i==0){
				l[counta]=i;
				counta++;
				a=a/i;
				i--;
			}
		} if(a%i==0){
				l[counta]=i;
				counta++;
				a=a/i;
				i--;
			} a%i==0 a%i a i 0 {
				l[counta]=i;
				counta++;
				a=a/i;
				i--;
			} l[counta]=i l[counta] l counta i counta++ counta a=a/i a a/i a i i-- i int[] y=new int[counta]; y new int[counta] counta for(int j=0;j<counta;j++){
			y[j]=l[j];
		} int j=0; int j=0; j 0 j<counta j counta j++ j++ j {
			y[j]=l[j];
		} {
			y[j]=l[j];
		} y[j]=l[j] y[j] y j l[j] l j return y; y int a a public static boolean sosu(int a){
		for(int j=2;j<=a;j++){
			if(a==j){
				return true;
			}else if(a%j==0)return false;
		}
		return false;
	} sosu {
		for(int j=2;j<=a;j++){
			if(a==j){
				return true;
			}else if(a%j==0)return false;
		}
		return false;
	} for(int j=2;j<=a;j++){
			if(a==j){
				return true;
			}else if(a%j==0)return false;
		} int j=2; int j=2; j 2 j<=a j a j++ j++ j {
			if(a==j){
				return true;
			}else if(a%j==0)return false;
		} {
			if(a==j){
				return true;
			}else if(a%j==0)return false;
		} if(a==j){
				return true;
			}else if(a%j==0)return false; a==j a j {
				return true;
			} return true; true if(a%j==0)return false; a%j==0 a%j a j 0 return false; false return false; false int a a public static int[] kobaisu(int[] a,int[] b){
		int[] n= {1,1};
		int j=0,i=0;
		
		while(i<a.length&&j<b.length){
			if(a[i]==b[j]){
				n[0]=n[0]*a[i];
				n[1]=n[1]*a[i];
				i++;j++;
			}else if(a[i]>b[j]){
				n[0]=n[0]*b[j];
				j++;		
			}else if(a[i]<b[j]){
				n[0]=n[0]*a[i];
				i++;
			}
		}
		while(i<a.length){
			n[0]=n[0]*a[i];
			i++;
		}
		while(j<b.length){
			n[0]=n[0]*b[j];
			j++;
		}
		return n;
	} kobaisu {
		int[] n= {1,1};
		int j=0,i=0;
		
		while(i<a.length&&j<b.length){
			if(a[i]==b[j]){
				n[0]=n[0]*a[i];
				n[1]=n[1]*a[i];
				i++;j++;
			}else if(a[i]>b[j]){
				n[0]=n[0]*b[j];
				j++;		
			}else if(a[i]<b[j]){
				n[0]=n[0]*a[i];
				i++;
			}
		}
		while(i<a.length){
			n[0]=n[0]*a[i];
			i++;
		}
		while(j<b.length){
			n[0]=n[0]*b[j];
			j++;
		}
		return n;
	} int[] n= {1,1}; n {1,1} 1 1 int j=0 j 0 i=0; i 0 while(i<a.length&&j<b.length){
			if(a[i]==b[j]){
				n[0]=n[0]*a[i];
				n[1]=n[1]*a[i];
				i++;j++;
			}else if(a[i]>b[j]){
				n[0]=n[0]*b[j];
				j++;		
			}else if(a[i]<b[j]){
				n[0]=n[0]*a[i];
				i++;
			}
		} i<a.length&&j<b.length i<a.length i a.length a a.length j<b.length j b.length b b.length {
			if(a[i]==b[j]){
				n[0]=n[0]*a[i];
				n[1]=n[1]*a[i];
				i++;j++;
			}else if(a[i]>b[j]){
				n[0]=n[0]*b[j];
				j++;		
			}else if(a[i]<b[j]){
				n[0]=n[0]*a[i];
				i++;
			}
		} if(a[i]==b[j]){
				n[0]=n[0]*a[i];
				n[1]=n[1]*a[i];
				i++;j++;
			}else if(a[i]>b[j]){
				n[0]=n[0]*b[j];
				j++;		
			}else if(a[i]<b[j]){
				n[0]=n[0]*a[i];
				i++;
			} a[i]==b[j] a[i] a i b[j] b j {
				n[0]=n[0]*a[i];
				n[1]=n[1]*a[i];
				i++;j++;
			} n[0]=n[0]*a[i] n[0] n 0 n[0]*a[i] n[0] n 0 a[i] a i n[1]=n[1]*a[i] n[1] n 1 n[1]*a[i] n[1] n 1 a[i] a i i++ i j++ j if(a[i]>b[j]){
				n[0]=n[0]*b[j];
				j++;		
			}else if(a[i]<b[j]){
				n[0]=n[0]*a[i];
				i++;
			} a[i]>b[j] a[i] a i b[j] b j {
				n[0]=n[0]*b[j];
				j++;		
			} n[0]=n[0]*b[j] n[0] n 0 n[0]*b[j] n[0] n 0 b[j] b j j++ j if(a[i]<b[j]){
				n[0]=n[0]*a[i];
				i++;
			} a[i]<b[j] a[i] a i b[j] b j {
				n[0]=n[0]*a[i];
				i++;
			} n[0]=n[0]*a[i] n[0] n 0 n[0]*a[i] n[0] n 0 a[i] a i i++ i while(i<a.length){
			n[0]=n[0]*a[i];
			i++;
		} i<a.length i a.length a a.length {
			n[0]=n[0]*a[i];
			i++;
		} n[0]=n[0]*a[i] n[0] n 0 n[0]*a[i] n[0] n 0 a[i] a i i++ i while(j<b.length){
			n[0]=n[0]*b[j];
			j++;
		} j<b.length j b.length b b.length {
			n[0]=n[0]*b[j];
			j++;
		} n[0]=n[0]*b[j] n[0] n 0 n[0]*b[j] n[0] n 0 b[j] b j j++ j return n; n int[] a a int[] b b public class Main {
	public static void main(String[]args){
		Scanner s =new Scanner(System.in);
		while(s.hasNext()){
			int a =s.nextInt();
			int b =s.nextInt();
			int[] y =yakusu(a);
			int[] z =yakusu(b);
			int n[]=kobaisu(z,y);
			System.out.println(Integer.toString(n[1])+" "+Integer.toString(n[0]));
		}
	}
	public static int[] yakusu(int a){
		int[] l =new int[(int)Math.sqrt((double)a)+1];
		int counta=0;
		for(int i=2;i<=a;i++){
			if(a%i==0){
				l[counta]=i;
				counta++;
				a=a/i;
				i--;
			}
		}
		int[] y=new int[counta];
		for(int j=0;j<counta;j++){
			y[j]=l[j];
		}
		return y;
	}
	
	public static boolean sosu(int a){
		for(int j=2;j<=a;j++){
			if(a==j){
				return true;
			}else if(a%j==0)return false;
		}
		return false;
	}
	public static int[] kobaisu(int[] a,int[] b){
		int[] n= {1,1};
		int j=0,i=0;
		
		while(i<a.length&&j<b.length){
			if(a[i]==b[j]){
				n[0]=n[0]*a[i];
				n[1]=n[1]*a[i];
				i++;j++;
			}else if(a[i]>b[j]){
				n[0]=n[0]*b[j];
				j++;		
			}else if(a[i]<b[j]){
				n[0]=n[0]*a[i];
				i++;
			}
		}
		while(i<a.length){
			n[0]=n[0]*a[i];
			i++;
		}
		while(j<b.length){
			n[0]=n[0]*b[j];
			j++;
		}
		return n;
	}
} public class Main {
	public static void main(String[]args){
		Scanner s =new Scanner(System.in);
		while(s.hasNext()){
			int a =s.nextInt();
			int b =s.nextInt();
			int[] y =yakusu(a);
			int[] z =yakusu(b);
			int n[]=kobaisu(z,y);
			System.out.println(Integer.toString(n[1])+" "+Integer.toString(n[0]));
		}
	}
	public static int[] yakusu(int a){
		int[] l =new int[(int)Math.sqrt((double)a)+1];
		int counta=0;
		for(int i=2;i<=a;i++){
			if(a%i==0){
				l[counta]=i;
				counta++;
				a=a/i;
				i--;
			}
		}
		int[] y=new int[counta];
		for(int j=0;j<counta;j++){
			y[j]=l[j];
		}
		return y;
	}
	
	public static boolean sosu(int a){
		for(int j=2;j<=a;j++){
			if(a==j){
				return true;
			}else if(a%j==0)return false;
		}
		return false;
	}
	public static int[] kobaisu(int[] a,int[] b){
		int[] n= {1,1};
		int j=0,i=0;
		
		while(i<a.length&&j<b.length){
			if(a[i]==b[j]){
				n[0]=n[0]*a[i];
				n[1]=n[1]*a[i];
				i++;j++;
			}else if(a[i]>b[j]){
				n[0]=n[0]*b[j];
				j++;		
			}else if(a[i]<b[j]){
				n[0]=n[0]*a[i];
				i++;
			}
		}
		while(i<a.length){
			n[0]=n[0]*a[i];
			i++;
		}
		while(j<b.length){
			n[0]=n[0]*b[j];
			j++;
		}
		return n;
	}
} Main
import java.util.Scanner;
import java.math.*;
public class Main {
	public static void main(String[]args){
		Scanner s =new Scanner(System.in);
		while(s.hasNext()){
			int a =s.nextInt();
			int b =s.nextInt();
			int[] y =yakusu(a);
			int[] z =yakusu(b);
			int n[]=kobaisu(z,y);
			System.out.println(Integer.toString(n[1])+" "+Integer.toString(n[0]));
		}
	}
	public static int[] yakusu(int a){
		int[] l =new int[(int)Math.sqrt((double)a)+1];
		int counta=0;
		for(int i=2;i<=a;i++){
			if(a%i==0){
				l[counta]=i;
				counta++;
				a=a/i;
				i--;
			}
		}
		int[] y=new int[counta];
		for(int j=0;j<counta;j++){
			y[j]=l[j];
		}
		return y;
	}
	
	public static boolean sosu(int a){
		for(int j=2;j<=a;j++){
			if(a==j){
				return true;
			}else if(a%j==0)return false;
		}
		return false;
	}
	public static int[] kobaisu(int[] a,int[] b){
		int[] n= {1,1};
		int j=0,i=0;
		
		while(i<a.length&&j<b.length){
			if(a[i]==b[j]){
				n[0]=n[0]*a[i];
				n[1]=n[1]*a[i];
				i++;j++;
			}else if(a[i]>b[j]){
				n[0]=n[0]*b[j];
				j++;		
			}else if(a[i]<b[j]){
				n[0]=n[0]*a[i];
				i++;
			}
		}
		while(i<a.length){
			n[0]=n[0]*a[i];
			i++;
		}
		while(j<b.length){
			n[0]=n[0]*b[j];
			j++;
		}
		return n;
	}
}