#include <stdio.h>

int main(void) {
  int a, b, divisor, dividend, remainder, result;
  while (scanf("%d %d", &a, &b) != EOF) {
    if (a > b) {
      dividend = a;
      divisor = b;
    }
    else {
      dividend = b;
      divisor = a;
    }	
    while (dividend % divisor != 0) {
      remainder = dividend % divisor;
      dividend = divisor;
      divisor = remainder;
    }
    result = divisor;
    printf("%d\n", result);
  }
  return(0);
}