eolymp
bolt
Try our new interface for solving problems
Problems

The Very Greatest Common Divisor

The Very Greatest Common Divisor

You need to find greatest common divisor of two integers \textbf{a} and \textbf{b}. Each number \textbf{a} and \textbf{b} are determinants of the square matrix of the form: \includegraphics{https://static.e-olymp.com/content/d3/d3b25b47a795aa2dfb248a937bd10bcd9f099597.jpg} \InputFile The first line of the input file contains number \textbf{n} < \textbf{250} of test cases. The description of a test case consists of two lines. The first line contains integer \textbf{a} (\textbf{0} < \textbf{a} < \textbf{10^12540}), the second -- integer \textbf{b} (\textbf{0} < \textbf{b} < \textbf{10^12540}). \OutputFile For each test case print the greatest common divisor of integers \textbf{a} and \textbf{b} on a separate line.
Time limit 2 seconds
Memory limit 64 MiB
Input example #1
3
2
3
3
21
6765
610
Output example #1
1
3
5
Source All-Ukrainian Collegiate Programming Contest Semi-Final 2010