#include<stdio.h>

int main(void){
	int a, b, n, i, gcd;

	while (scanf("%d %d", &a, &b) != EOF){
		if (a > b){
			n = a;
		}
		else{
			n = b;
		}

		for (i = 1; i <= n; i++){
			if (a%i == 0){
				if (b%i == 0){
					gcd = i;
				}
			}
		}
		
		printf("%d\n", gcd);
	}

	return 0;
}