গরিষ্ঠ সাধারণ গুণনীয়ক ( Greatest Common Divisor )

CPU: 1s
Memory: 1024MB


পিটার ও টুরিস্ট ক্রিকেট খেলছিল। তাদের খেলার নিজেদের নিয়ম আছে। পিটার অনেক ভাল খেলে। সে টসে জিতে ব্যাটিং নিল এবং A রান করল। তারপর টুরিস্ট সেই রানের তাড়া শুরু করল। খেলা অনেক কঠিন ছিল এবং টুরিস্ট B রান করার পর হঠাৎ করে বৃষ্টি শুরু হল এবং তারা দ্বন্দ্বে পড়ে গেল এখন কি করা যায়। তাদের খেলায় বৃষ্টির জন্য কোন নিয়ম ছিল না। কিন্তু টুরিস্ট অনেক বুদ্ধিমান এবং চালাক। সে বলল বৃষ্টির পর তার নতুন টার্গেট হবে C = B + GCD( A , B )। পিটার এই নিয়মে খুশিই ছিল। সে দ্রুত দুইটি সংখ্যা AB এর গসাগু বের করার জন্য একটি প্রোগ্রাম লিখে ফেলল। আমাদের এই সমস্যাটা ঠিক একই রকম। তোমাকে A এবং B এর মান দেওয়া হবে। তোমার কাজ হবে তাদের গসাগু বের করা।

Petr and Tourist were playing cricket (They have their own rules for cricket). Petr is very good in cricket. He won the toss and scored A runs. Then Tourist started chasing Petr's score. It was indeed a tough match and Tourist scored B runs, where B is less than or equal to A. Suddenly it starts to rain and they got confused about what to do. They didn't have exact rules for raining. But as Tourist is too much talented and clever, he said after the rain stops his new target will be C = B + GCD( A , B ). Petr was happy about this new formula. Soon he wrote a code to find the Greatest Common Divisor ( GCD ) of A and B. This problem is also similar. You'll be given A and B. You have to find their GCD.


ইনপুটের বর্ণনা

প্রথম লাইনে ইনপুটের সংখ্যা T (0<T<=10000) দেওয়া থাকবে। পরবর্তী T লাইনে দুইটা করে পূর্ণসংখ্যা A এবং B দেয়া থাকবে। এখানে, 0<B<A<=1000000


Input Specification

First line will have the number of test cases T (0 < T<=10000). And in next T lines there will be two integers A and B. Here 0<B<A<=1000000.


আউটপুট এর বর্ণনা

প্রতিটি ইনপুটের জন্য তোমাকে শুধুমাত্র AB এর গরিষ্ঠ সাধারণ গুণনীয়ক প্রিন্ট করতে হবে।

৩০ শতাংশ পয়েন্টের জন্য, 0<T<=1000 এবং 0<B<A<=1000

১০০ শতাংশ পয়েন্টের জন্য, ইনপুট বর্ণনা দেখো।


Output Specification

For each input you just need to print the GCD of A,B.

For 30% points, 0<T<=1000 and 0<B<A<=1000

For 100% points, follow input constraints.


Sample

InputOutput
3 2 1 10 5 200 1001 5 100

Problemsetter: Mohammad Abdullah Matin Khan Zarzis