import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int x = scan.nextInt();
			int y = scan.nextInt();
			while(x != 0 && y != 0){
				int t = y;
				y = x;
				x = t % x;
			}
			System.out.println((x == 0)?y:x);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int x = scan.nextInt();
			int y = scan.nextInt();
			while(x != 0 && y != 0){
				int t = y;
				y = x;
				x = t % x;
			}
			System.out.println((x == 0)?y:x);
		}
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int x = scan.nextInt();
			int y = scan.nextInt();
			while(x != 0 && y != 0){
				int t = y;
				y = x;
				x = t % x;
			}
			System.out.println((x == 0)?y:x);
		}
	} main {
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int x = scan.nextInt();
			int y = scan.nextInt();
			while(x != 0 && y != 0){
				int t = y;
				y = x;
				x = t % x;
			}
			System.out.println((x == 0)?y:x);
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) while(scan.hasNext()){
			int x = scan.nextInt();
			int y = scan.nextInt();
			while(x != 0 && y != 0){
				int t = y;
				y = x;
				x = t % x;
			}
			System.out.println((x == 0)?y:x);
		} scan.hasNext() scan.hasNext scan {
			int x = scan.nextInt();
			int y = scan.nextInt();
			while(x != 0 && y != 0){
				int t = y;
				y = x;
				x = t % x;
			}
			System.out.println((x == 0)?y:x);
		} int x = scan.nextInt(); x scan.nextInt() scan.nextInt scan int y = scan.nextInt(); y scan.nextInt() scan.nextInt scan while(x != 0 && y != 0){
				int t = y;
				y = x;
				x = t % x;
			} x != 0 && y != 0 x != 0 x 0 y != 0 y 0 {
				int t = y;
				y = x;
				x = t % x;
			} int t = y; t y y = x y x x = t % x x t % x t x System.out.println((x == 0)?y:x) System.out.println System.out System System.out (x == 0)?y:x (x == 0) x 0 y x String[] args args public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int x = scan.nextInt();
			int y = scan.nextInt();
			while(x != 0 && y != 0){
				int t = y;
				y = x;
				x = t % x;
			}
			System.out.println((x == 0)?y:x);
		}
	}
} public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int x = scan.nextInt();
			int y = scan.nextInt();
			while(x != 0 && y != 0){
				int t = y;
				y = x;
				x = t % x;
			}
			System.out.println((x == 0)?y:x);
		}
	}
} Main
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int x = scan.nextInt();
			int y = scan.nextInt();
			while(x != 0 && y != 0){
				int t = y;
				y = x;
				x = t % x;
			}
			System.out.println((x == 0)?y:x);
		}
	}
}