#include <cstdio>
int GCD(int a, int b) {
if (a % b == 0) {
return b;
}
else {
return GCD(b, a % b);
}
}
int main() {
int a, b;
while ((scanf("%d%d", &a, &b)) != EOF) {
printf("%d\n", GCD(a, b));
}
return 0;
}
#include <cstdio>
int GCD(int a, int b) {
if (a % b == 0) {
return b;
}
else {
return GCD(b, a % b);
}
}
int main() {
int a, b;
while ((scanf("%d%d", &a, &b)) != EOF) {
printf("%d\n", GCD(a, b));
}
return 0;
}