Problem:
Problem A: Greatest Common Divisor

Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.

Input

The input file consists of several lines with pairs of two natural numbers in each line. The numbers do not exceed 100000.

The number of pairs (datasets) is less than 50.

Output

Your program has to print the greatest common divisor for each pair of input numbers. Print each result on a new line.

Sample Input

57 38
60 84

Output for the Sample Input

19
12

Solution in C# (judge verdict: Accepted)

#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;

static class MainClass
{
    public static void Main(string[] args)
    {
        try{
        while (true)
        {
            var str = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            if (str.Length <= 0)
                return;
            var num = new List<int>();
            foreach (var item in str)
            {
                num.Add(int.Parse(item));
            }

            Console.WriteLine(Gcd(num[0], num[1]));
        }}catch{}
    }


    public static int Gcd(int a, int b)
    {
        if (b == 0)
            return a;
        return Gcd(b, a % b);
    }


}