Problems
520 - GCD
SUBMIT PROBLEM

GCD

Time Limit: 1 sec

 

The Problem

In mathematics, the greatest common divisor (GCD) of two or more integers, when at least one of them is not zero, is the largest positive integer that divides the numbers without a remainder. For example, the GCD of 8 and 12 is 4.

Example,

GCD(8, 12) = 4

GCD(10, 100) = 10

GCD(13, 100) = 1

GCD(16, 100) = 4

 

The Input

Input file contain a series of line, each line contain two integer numbers m and n (0<m,n<1010). Input is terminated by EOF.

 

The Output

For each line of input, output will show the GCD of m, n (GCD(m,n)) in a separate line.

 

Sample Input

3 33

33 3

18 79

8 12

 

Sample Output

3

3

1

4

 

 

 

 

Problem Setter: Shahin ShamS