#nt102. 扩展欧几里得
扩展欧几里得
Extended Euclidean Algorithm
Problem Description
Read , then test cases follow. Each case gives two numbers ; output the minimal non-negative integer solution to .
Input Format
The first line contains one integer .
Each of the next lines contains two numbers .
Output Format
Output lines, each containing two numbers: and .
Sample Input
2
1 2
100 150
Sample Output
1 0
2 1
Constraints
For of the test cases, and .