#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
int gcd(int, int);
int main() {
	int x, y;
	for(;~fscanf(stdin,"%d%d", &x, &y);fprintf(stdout,"%d\n", gcd(x, y)));
	return 0;
}

int gcd(int x, int y) {
	int tmp;
	if (x < y) { tmp = x; x = y; y = tmp; }
	if (x%y == 0) return y;
	gcd(x%y, y);
}