#include<stdio.h>

int main()
{
 long n,m,i,j,k,l;
 
 while(scanf("%ld %ld",&n,&m)!=EOF)
 {
   if(n>m) l=m;
   else l=n;
   if(n%l==0&&m%l==0)  printf("%ld\n",l);
   else
   {
   for(i=1;i<=l/2;i++)
   {
    if(n%i==0&&m%i==0) k=i;
   }
   printf("%ld\n",k);
  }
 }
 return 0;
}