这题的中文意思是什么?求救!!!
Problem Description
In the case of moduling a prime number P, A is called multiplicative inverse of B if and only if A * B ≡ 1 (mod P)(0 < A, B < P), now it is a quite simple question: give you B and a prime number P,you should found that A describe above.
Input
The first line contains a single integer T, indicating the number of test cases.Each test case begin with two integer B and P (1 <= B < P <= 5000).
Output
For each test case output the answer.
Sample Input
1
5 7
Sample Output
3