Congruence Problem

Input will consist of multiple test cases. The first line will contain an integer $ T (1 \leq T \leq 10^5) $, the number of test cases.


This is a companion discussion topic for the original entry at https://toph.co/p/congruence-problem