Yesterday, Devansh and Akar were bored due to Internet Shutdown. So they decided to play a game. Devansh being a Math lover always come up with some innovative games to play. But this time he came up with an innovative way of scoring. We don't know what game they played, but we know how they kept the score. Following are the scoring rules for that game.
They will play some N number of games. The winner of the ith game will get i points. And it is guaranteed that only one player will win a particular game and no ties happen.
Now you will be given two integers X and Y, total points of Devansh and Akar respectively which they want to achieve after some number of games. You have to say exactly how many games will they have to play so that they both can have exact these many points. If it is not possible for any N number of games, print -1.
Input Format:
First line contains T , number of test cases.
Next T lines contains two integers X and Y each, denoting total points Devansh and Akar wants to achieve.
Output Format:
For each test case, print the exact number of game they have to play.
Constraints:
1 <= T <= 100
1 <= X, Y <= 10^12
Setter: Rutul Patel