/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author LH
 */
public class Ggt
{
    public static void main(String[] args) throws Exception
    {
        InteractiveIO i = new InteractiveIO();
        String intemp = i.promptAndRead("Zahl 1");
        while(intemp.length()>0)
        {
            int x =Integer.parseInt(intemp);
            int y =Integer.parseInt(i.promptAndRead("Zahl 2"));
            System.out.println(calculateGGTcheck(x,y));
            intemp=i.promptAndRead("Zahl 1");
        }
    }
    
            private static int calculateGGTcheck(int x,int y)
        {
            return y==0?0:calculateGGT(x,y);
        }
    
    
    private static int calculateGGT(int x, int y)
    {
        int rest = x%y;
        return rest==0?y:calculateGGT(y, rest);
    }
    
}
