import java.math.BigInteger;
import java.util.Scanner;
public class codeTest {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
while(in.hasNext()){
BigInteger a = in.nextBigInteger();
BigInteger b = in.nextBigInteger();
System.out.printf("%d", a.gcd(b));
}
in.close();
}
}