#include <stdio.h>

int gcd(int,int);

main()
{
  int a=0,b=0;
  int cd=0;

  while(scanf("%d %d",&a,&b) != EOF)
    {
      cd = gcd(a,b);
      printf("%d\n",cd);
    }
  return 0;
}

int gcd(int m,int n)
{
	// øÉOª éêÍOðÔ·
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// [NbhÌû@
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}