import java.util.Scanner;

 public class Main{
	 public static void main(String[] args){
		 Scanner s = new Scanner(System.in);
		 while(s.hasNextInt()){
			 int a = s.nextInt();
			 int b = s.nextInt();
			 int c = a;
			 int d = b;
			 int max = a;
			 int mox = b;
			 int mix = max;
			while(max != mox){
				if(mox > max){max = mox; mox = mix;}
				max = max - mox;
				mix = max;
			}
			while(a!=b){
				if(a<b) a += c;
				if(a>b) b += d;
			}
			System.out.println(mox+" "+a);
		 }
		 }
	 }  import java.util.Scanner; Scanner java.util public class Main{
	 public static void main(String[] args){
		 Scanner s = new Scanner(System.in);
		 while(s.hasNextInt()){
			 int a = s.nextInt();
			 int b = s.nextInt();
			 int c = a;
			 int d = b;
			 int max = a;
			 int mox = b;
			 int mix = max;
			while(max != mox){
				if(mox > max){max = mox; mox = mix;}
				max = max - mox;
				mix = max;
			}
			while(a!=b){
				if(a<b) a += c;
				if(a>b) b += d;
			}
			System.out.println(mox+" "+a);
		 }
		 }
	 } Main public static void main(String[] args){
		 Scanner s = new Scanner(System.in);
		 while(s.hasNextInt()){
			 int a = s.nextInt();
			 int b = s.nextInt();
			 int c = a;
			 int d = b;
			 int max = a;
			 int mox = b;
			 int mix = max;
			while(max != mox){
				if(mox > max){max = mox; mox = mix;}
				max = max - mox;
				mix = max;
			}
			while(a!=b){
				if(a<b) a += c;
				if(a>b) b += d;
			}
			System.out.println(mox+" "+a);
		 }
		 } main {
		 Scanner s = new Scanner(System.in);
		 while(s.hasNextInt()){
			 int a = s.nextInt();
			 int b = s.nextInt();
			 int c = a;
			 int d = b;
			 int max = a;
			 int mox = b;
			 int mix = max;
			while(max != mox){
				if(mox > max){max = mox; mox = mix;}
				max = max - mox;
				mix = max;
			}
			while(a!=b){
				if(a<b) a += c;
				if(a>b) b += d;
			}
			System.out.println(mox+" "+a);
		 }
		 } Scanner s = new Scanner(System.in); s new Scanner(System.in) while(s.hasNextInt()){
			 int a = s.nextInt();
			 int b = s.nextInt();
			 int c = a;
			 int d = b;
			 int max = a;
			 int mox = b;
			 int mix = max;
			while(max != mox){
				if(mox > max){max = mox; mox = mix;}
				max = max - mox;
				mix = max;
			}
			while(a!=b){
				if(a<b) a += c;
				if(a>b) b += d;
			}
			System.out.println(mox+" "+a);
		 } s.hasNextInt() s.hasNextInt s {
			 int a = s.nextInt();
			 int b = s.nextInt();
			 int c = a;
			 int d = b;
			 int max = a;
			 int mox = b;
			 int mix = max;
			while(max != mox){
				if(mox > max){max = mox; mox = mix;}
				max = max - mox;
				mix = max;
			}
			while(a!=b){
				if(a<b) a += c;
				if(a>b) b += d;
			}
			System.out.println(mox+" "+a);
		 } int a = s.nextInt(); a s.nextInt() s.nextInt s int b = s.nextInt(); b s.nextInt() s.nextInt s int c = a; c a int d = b; d b int max = a; max a int mox = b; mox b int mix = max; mix max while(max != mox){
				if(mox > max){max = mox; mox = mix;}
				max = max - mox;
				mix = max;
			} max != mox max mox {
				if(mox > max){max = mox; mox = mix;}
				max = max - mox;
				mix = max;
			} if(mox > max){max = mox; mox = mix;} mox > max mox max {max = mox; mox = mix;} max = mox max mox mox = mix mox mix max = max - mox max max - mox max mox mix = max mix max while(a!=b){
				if(a<b) a += c;
				if(a>b) b += d;
			} a!=b a b {
				if(a<b) a += c;
				if(a>b) b += d;
			} if(a<b) a += c; a<b a b a += c a c if(a>b) b += d; a>b a b b += d b d System.out.println(mox+" "+a) System.out.println System.out System System.out mox+" "+a mox+" "+a mox " " a String[] args args public class Main{
	 public static void main(String[] args){
		 Scanner s = new Scanner(System.in);
		 while(s.hasNextInt()){
			 int a = s.nextInt();
			 int b = s.nextInt();
			 int c = a;
			 int d = b;
			 int max = a;
			 int mox = b;
			 int mix = max;
			while(max != mox){
				if(mox > max){max = mox; mox = mix;}
				max = max - mox;
				mix = max;
			}
			while(a!=b){
				if(a<b) a += c;
				if(a>b) b += d;
			}
			System.out.println(mox+" "+a);
		 }
		 }
	 } public class Main{
	 public static void main(String[] args){
		 Scanner s = new Scanner(System.in);
		 while(s.hasNextInt()){
			 int a = s.nextInt();
			 int b = s.nextInt();
			 int c = a;
			 int d = b;
			 int max = a;
			 int mox = b;
			 int mix = max;
			while(max != mox){
				if(mox > max){max = mox; mox = mix;}
				max = max - mox;
				mix = max;
			}
			while(a!=b){
				if(a<b) a += c;
				if(a>b) b += d;
			}
			System.out.println(mox+" "+a);
		 }
		 }
	 } Main
import java.util.Scanner;

 public class Main{
	 public static void main(String[] args){
		 Scanner s = new Scanner(System.in);
		 while(s.hasNextInt()){
			 int a = s.nextInt();
			 int b = s.nextInt();
			 int c = a;
			 int d = b;
			 int max = a;
			 int mox = b;
			 int mix = max;
			while(max != mox){
				if(mox > max){max = mox; mox = mix;}
				max = max - mox;
				mix = max;
			}
			while(a!=b){
				if(a<b) a += c;
				if(a>b) b += d;
			}
			System.out.println(mox+" "+a);
		 }
		 }
	 } 