NUM06 - GCD!!!

no tags 

You are given two number.Find out the Greatest Common Divisior or GCD.Let's see how we can determine GCD of two numbers.

n=min(m,n);

if m=20 and n=5,then min(m,n)=5; Now there are only 5 from 1 to n, who is divisior of both(20 and 5) .So gcd(20,5)=5.

Attention: Do not use any library function.

Input

Every line wil contain two number m,n (1<=m,n<=10^18).

m,n=0 will terminate the programme.

Output

Print the GCD of two number.

Example

Input:
5 6
3 9
10 2
0 0

Output:
1
3
2


Added by:Ruhul
Date:2019-09-15
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C NCSHARP JULIA PYPY3