Greatest Common Divisor


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Problem type
Allowed languages
C++, Python

Greatest Common Divisor Problem

Given n pairs of positive integers (ai, bi), find the greatest common divisor (GCD) for each pair.

Input Format

  • The first line contains an integer n.
  • Each of the next n lines contains two integers ai and bi.

Output Format
Output n lines, each containing the GCD of the corresponding pair.

Data Range
1 ≤ n ≤ 105
1 ≤ ai, bi ≤ 2 × 109

Sample Input

2
3 6
4 6

Sample Output

3
2

Comments

There are no comments at the moment.