Problem5804--辗转相除法

5804: 辗转相除法

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

给定 $n$ 对正整数 $a_i,\ b_i$,请你求出每对数的最大公约数。

Input

第一行包含整数 $n\ (1 \leq n \leq 10^5)$。
接下来 $n$ 行,每行包含一个整数对 $a_i,\ b_i\ (1 \leq a_i,\ b_i \leq 2 \times 10^9)$。

Output

输出共 $n$ 行,每行输出一个整数对的最大公约数。

Sample 1 Input

2
3 6
4 6

Sample 1 Output

3
2

Source/Category

数学 10.2.约数