Henry, an advocate for paper, has been amazed by the recent developments in the paper industry!
From paper straws, paper spoons to paper knives, he was astonished by all the amazing things that can be made by paper.

This sparked his curiosity, and he decided to learn about paper cutting.
Formally paper cutting of a paper of length $L$ and width $W$ follows the procedure below:

  • If $L=W$ then end the procedure.
  • If $L\lt W$ then cut the paper into a $L$ by $L$ square and a $L$ by $W-L$ rectangle, repeat the procedure with the rectangular piece.
  • If $L\gt W$ then cut the paper into a $W$ by $W$ square and a $L-W$ by $W$ rectangle, repeat the procedure with the rectangular piece.

However, Henry is particularly interested in the side length of the smallest square obtained from cutting papers.
Denote $S_{L,W}$ to be the side length of the smallest square obtained from a paper of dimensions $L$ by $W$.
He wonders if there exists papers of integer $L$ and $W$ with perimeter $P$ with particular $S_{L,W}$.

Formally, he has $Q$ questions, asking you to suggest a valid dimension of paper of perimeter $P_i$, with $S_{L,W}=T_i$ with minimum $W-L$ and $\bm{L\leq W}$ or determine that there is no such paper.
Help Henry cure his paper curiosity!

Input

The first line contains one integer, $Q$.
The next $Q$ lines contain two integers $P_i$ and $T_i$.

Output

Output $Q$ lines, output a pair of integers $L$ and $W$ where $\bm{L\leq W}$ if there exists such paper or output -1 if there is not.

Constraints

For all subtasks:
$1\le Q\le 2\times10^5$
$1\le P_i, T_i\le 10^{18}$


Subtask 1 (8%): $Q=1$, There is always a valid solution where $1\le L, W\le 1000$.
Subtask 2 (11%): $1\le Q\le 1000$, There is always a valid solution where $1\le L, W\le 1000$.
Subtask 3 (12%): $Q=1$, $1\le P_i \le 5\times10^5$
Subtask 4 (27%): $1\le Q\le 1000$, $1\le P_i\le10^6$, $T_i\geq10^3$
Subtask 5 (42%): No additional constraints

Sample Test Cases

Input Output
6
10 5
36 6
49 7
64 8
216 9
460 10
-1
6 12
-1
8 24
45 63
110 120
Click to copy.

Scoring: Per Subtask
Authored by s19x17
Appeared in 2024 TFT Practice Competition