#include <stdio.h>

int GCD (int a, int b) {
	int c;
	c = a % b;
	if (c == 0) {
		return b;
	} else {
		return GCD (b, c);
	}
	
}

int main () {
	int x, y, z;
	
	while (scanf("%d %d", &x, &y) != EOF) {
		
		z = GCD (x, y);
		
		printf ("%d\n", z);
	}
	
	return 0;
}