Rikka struggles with math. Observing this, Yuta decides to help her improve by assigning some math practice tasks. Here is one such task.
The task requires transforming one integer, �a, into another, �b, where �≠�a=b. In a single operation, Rikka can either add a positive square number to �a, or subtract a positive square number from �a. The goal is to convert �a into �b by executing the least number of operations.
A square number is an integer that is the product of some integer with itself. For example, 11, 44, 99, and 1616 are square numbers, as they are the squares of 11, 22, 33, and 44, respectively.
The problem might seem complex for Rikka. Can you assist Rikka in solving this?
The first line contains one integer �T (1≤�≤1031≤T≤103), indicating the number of test cases.
For each test case, the only line contains two integers �,�a,b (1≤�,�≤1091≤a,b≤109, �≠�a≠b).
2
1 4
5 1
2
1