#include <cstdio>
#include <algorithm>
using namespace std;

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