#include <stdio.h>

int main(void)
{
	int a, b;
	int n, m;
	int t;
	
	while (scanf("%d%d", &a, &b) != EOF){
		n = a;
		m = b;
		if (a < b){
			n = b;
			m = a;
		}
		
		while (n > 0){
			t = n;
			n = m % n;
			m = t;
		}
		
		printf("%d\n", m);
	}
	
	return (0);
}