import java.util.*;
import java.math.BigInteger;
public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in) ;
int n;
Scanner n = new Scanner(System.in);
while(n != 0)
{
BigInteger a =cin.nextBigInteger();
BigInteger b =cin.nextBigInteger();
BigInteger ans=a.gcd(b);
System.out.println(ans);
n--;
}
}
}