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: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace Test1 {

    class ClassMain {

        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine())!=null) {
                string[] strs = line.Split(' ');
                int n0 = int.Parse(strs[0]), n1 = int.Parse(strs[1]);
                int[] ints = new int[2] { n0, n1 };
                while (euclid(ints)) { };
                Console.WriteLine(ints[1]);
            }
        }
        private static bool euclid(int[] ints) {
            int large = Math.Max(ints[0],ints[1]);
            int small = Math.Min(ints[0],ints[1]);
            if (large % small == 0) { return false; }
            ints[0] = small; ints[1] = large % small;
            return true;
        }
    }
}