

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		while(stdIn.hasNext()){
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			int c = a;
			int d = b;
			
			if(a<b){
				int tmp = b;
				b = a;
				a = tmp;
			}
			
			while(true){
				if(a%b==0){
					System.out.print(b+" ");
					break;
				}
				int tmp = a%b;
				a = b;
				b = tmp;
			}
			
			func(c,d);
			
		}
	}
	
	static void func(int a,int b){
		int ans = 1;
		int i = 2;
		
		while(a*b!=1){
			int count_a = 0;
			int count_b = 0;
			while(a%i==0){
				count_a++;
				a = a/i;
			}
			while(b%i==0){
				count_b++;
				b = b/i;
			}
			int t = Math.max(count_a, count_b);
			ans = ans*(int)Math.pow(i,Math.max(count_a, count_b));
			i++;
		}
		
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		while(stdIn.hasNext()){
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			int c = a;
			int d = b;
			
			if(a<b){
				int tmp = b;
				b = a;
				a = tmp;
			}
			
			while(true){
				if(a%b==0){
					System.out.print(b+" ");
					break;
				}
				int tmp = a%b;
				a = b;
				b = tmp;
			}
			
			func(c,d);
			
		}
	}
	
	static void func(int a,int b){
		int ans = 1;
		int i = 2;
		
		while(a*b!=1){
			int count_a = 0;
			int count_b = 0;
			while(a%i==0){
				count_a++;
				a = a/i;
			}
			while(b%i==0){
				count_b++;
				b = b/i;
			}
			int t = Math.max(count_a, count_b);
			ans = ans*(int)Math.pow(i,Math.max(count_a, count_b));
			i++;
		}
		
		System.out.println(ans);
	}
} Main public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		while(stdIn.hasNext()){
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			int c = a;
			int d = b;
			
			if(a<b){
				int tmp = b;
				b = a;
				a = tmp;
			}
			
			while(true){
				if(a%b==0){
					System.out.print(b+" ");
					break;
				}
				int tmp = a%b;
				a = b;
				b = tmp;
			}
			
			func(c,d);
			
		}
	} main {
		Scanner stdIn = new Scanner(System.in);
		
		while(stdIn.hasNext()){
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			int c = a;
			int d = b;
			
			if(a<b){
				int tmp = b;
				b = a;
				a = tmp;
			}
			
			while(true){
				if(a%b==0){
					System.out.print(b+" ");
					break;
				}
				int tmp = a%b;
				a = b;
				b = tmp;
			}
			
			func(c,d);
			
		}
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) while(stdIn.hasNext()){
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			int c = a;
			int d = b;
			
			if(a<b){
				int tmp = b;
				b = a;
				a = tmp;
			}
			
			while(true){
				if(a%b==0){
					System.out.print(b+" ");
					break;
				}
				int tmp = a%b;
				a = b;
				b = tmp;
			}
			
			func(c,d);
			
		} stdIn.hasNext() stdIn.hasNext stdIn {
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			int c = a;
			int d = b;
			
			if(a<b){
				int tmp = b;
				b = a;
				a = tmp;
			}
			
			while(true){
				if(a%b==0){
					System.out.print(b+" ");
					break;
				}
				int tmp = a%b;
				a = b;
				b = tmp;
			}
			
			func(c,d);
			
		} int a = stdIn.nextInt(); a stdIn.nextInt() stdIn.nextInt stdIn int b = stdIn.nextInt(); b stdIn.nextInt() stdIn.nextInt stdIn int c = a; c a int d = b; d b if(a<b){
				int tmp = b;
				b = a;
				a = tmp;
			} a<b a b {
				int tmp = b;
				b = a;
				a = tmp;
			} int tmp = b; tmp b b = a b a a = tmp a tmp while(true){
				if(a%b==0){
					System.out.print(b+" ");
					break;
				}
				int tmp = a%b;
				a = b;
				b = tmp;
			} true {
				if(a%b==0){
					System.out.print(b+" ");
					break;
				}
				int tmp = a%b;
				a = b;
				b = tmp;
			} if(a%b==0){
					System.out.print(b+" ");
					break;
				} a%b==0 a%b a b 0 {
					System.out.print(b+" ");
					break;
				} System.out.print(b+" ") System.out.print System.out System System.out b+" " b " " break; int tmp = a%b; tmp a%b a b a = b a b b = tmp b tmp func(c,d) func c d String[] args args static void func(int a,int b){
		int ans = 1;
		int i = 2;
		
		while(a*b!=1){
			int count_a = 0;
			int count_b = 0;
			while(a%i==0){
				count_a++;
				a = a/i;
			}
			while(b%i==0){
				count_b++;
				b = b/i;
			}
			int t = Math.max(count_a, count_b);
			ans = ans*(int)Math.pow(i,Math.max(count_a, count_b));
			i++;
		}
		
		System.out.println(ans);
	} func {
		int ans = 1;
		int i = 2;
		
		while(a*b!=1){
			int count_a = 0;
			int count_b = 0;
			while(a%i==0){
				count_a++;
				a = a/i;
			}
			while(b%i==0){
				count_b++;
				b = b/i;
			}
			int t = Math.max(count_a, count_b);
			ans = ans*(int)Math.pow(i,Math.max(count_a, count_b));
			i++;
		}
		
		System.out.println(ans);
	} int ans = 1; ans 1 int i = 2; i 2 while(a*b!=1){
			int count_a = 0;
			int count_b = 0;
			while(a%i==0){
				count_a++;
				a = a/i;
			}
			while(b%i==0){
				count_b++;
				b = b/i;
			}
			int t = Math.max(count_a, count_b);
			ans = ans*(int)Math.pow(i,Math.max(count_a, count_b));
			i++;
		} a*b!=1 a*b a b 1 {
			int count_a = 0;
			int count_b = 0;
			while(a%i==0){
				count_a++;
				a = a/i;
			}
			while(b%i==0){
				count_b++;
				b = b/i;
			}
			int t = Math.max(count_a, count_b);
			ans = ans*(int)Math.pow(i,Math.max(count_a, count_b));
			i++;
		} int count_a = 0; count_a 0 int count_b = 0; count_b 0 while(a%i==0){
				count_a++;
				a = a/i;
			} a%i==0 a%i a i 0 {
				count_a++;
				a = a/i;
			} count_a++ count_a a = a/i a a/i a i while(b%i==0){
				count_b++;
				b = b/i;
			} b%i==0 b%i b i 0 {
				count_b++;
				b = b/i;
			} count_b++ count_b b = b/i b b/i b i int t = Math.max(count_a, count_b); t Math.max(count_a, count_b) Math.max Math count_a count_b ans = ans*(int)Math.pow(i,Math.max(count_a, count_b)) ans ans*(int)Math.pow(i,Math.max(count_a, count_b)) ans (int)Math.pow(i,Math.max(count_a, count_b)) Math.pow Math i Math.max(count_a, count_b) Math.max Math count_a count_b i++ i System.out.println(ans) System.out.println System.out System System.out ans int a a int b b public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		while(stdIn.hasNext()){
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			int c = a;
			int d = b;
			
			if(a<b){
				int tmp = b;
				b = a;
				a = tmp;
			}
			
			while(true){
				if(a%b==0){
					System.out.print(b+" ");
					break;
				}
				int tmp = a%b;
				a = b;
				b = tmp;
			}
			
			func(c,d);
			
		}
	}
	
	static void func(int a,int b){
		int ans = 1;
		int i = 2;
		
		while(a*b!=1){
			int count_a = 0;
			int count_b = 0;
			while(a%i==0){
				count_a++;
				a = a/i;
			}
			while(b%i==0){
				count_b++;
				b = b/i;
			}
			int t = Math.max(count_a, count_b);
			ans = ans*(int)Math.pow(i,Math.max(count_a, count_b));
			i++;
		}
		
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		while(stdIn.hasNext()){
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			int c = a;
			int d = b;
			
			if(a<b){
				int tmp = b;
				b = a;
				a = tmp;
			}
			
			while(true){
				if(a%b==0){
					System.out.print(b+" ");
					break;
				}
				int tmp = a%b;
				a = b;
				b = tmp;
			}
			
			func(c,d);
			
		}
	}
	
	static void func(int a,int b){
		int ans = 1;
		int i = 2;
		
		while(a*b!=1){
			int count_a = 0;
			int count_b = 0;
			while(a%i==0){
				count_a++;
				a = a/i;
			}
			while(b%i==0){
				count_b++;
				b = b/i;
			}
			int t = Math.max(count_a, count_b);
			ans = ans*(int)Math.pow(i,Math.max(count_a, count_b));
			i++;
		}
		
		System.out.println(ans);
	}
} Main


import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		
		while(stdIn.hasNext()){
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			int c = a;
			int d = b;
			
			if(a<b){
				int tmp = b;
				b = a;
				a = tmp;
			}
			
			while(true){
				if(a%b==0){
					System.out.print(b+" ");
					break;
				}
				int tmp = a%b;
				a = b;
				b = tmp;
			}
			
			func(c,d);
			
		}
	}
	
	static void func(int a,int b){
		int ans = 1;
		int i = 2;
		
		while(a*b!=1){
			int count_a = 0;
			int count_b = 0;
			while(a%i==0){
				count_a++;
				a = a/i;
			}
			while(b%i==0){
				count_b++;
				b = b/i;
			}
			int t = Math.max(count_a, count_b);
			ans = ans*(int)Math.pow(i,Math.max(count_a, count_b));
			i++;
		}
		
		System.out.println(ans);
	}
}