Codeforces
CF Step
Youtube Linkedin Discord Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Statement : F. Interval Game

F. Interval Game

Alice and Bob are playing a game involving two intervals, $[l_1, r_1]$ and $[l_2, r_2]$, constrained by integers $x_1$ and $x_2$ respectively. The intervals satisfy $1 \le l_1 \le r_1 \le x_1$ and $1 \le l_2 \le r_2 \le x_2$.

The game is played as follows. In one turn, a player must choose one of the two intervals (let’s say the $i$-th interval $[l_i, r_i]$) and perform exactly one of the following operations:

  • Replace $l_i$ with a strictly smaller integer $l'_i$ such that $1 \le l'_i \lt l_i$.
  • Replace $r_i$ with a strictly larger integer $r'_i$ such that $r_i \lt r'_i \le x_i$.

The player who cannot make a valid move loses the game.

The game setup proceeds in two steps:

  • First, Alice chooses the values of $l_1$ and $r_1$ to determine the first interval. It must be a valid interval within $[1, x_1]$.
  • Then, the second interval $[l_2, r_2]$ is chosen uniformly at random from all possible valid intervals within $[1, x_2]$.

Once the intervals are chosen, the game begins with Alice moving first.

Assuming both Alice and Bob play optimally, Alice wants to choose the initial interval $[l_1, r_1]$ to maximize her probability of winning. Your task is to find such an interval. If there are multiple optimal intervals, you may output any one of them.


Input

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^4$). The description of the test cases follows.

The only line of each test case contains two integers $x_1$ and $x_2$ ($1 \le x_1, x_2 \le 5 \cdot 10^5$) — the upper bounds for the two intervals.

It is guaranteed that the sum of $x_1$ over all test cases does not exceed $5 \cdot 10^5$.

It is guaranteed that the sum of $x_2$ over all test cases does not exceed $5 \cdot 10^5$.


Output

For each test case, output two integers $l_1$ and $r_1$ ($1 \le l_1 \le r_1 \le x_1$) — the optimal interval chosen by Alice.

If there are multiple optimal intervals, you may output any one of them.


Example

Input

6
1 1
1 10
2 1
2 2
20 64578
185367 133524

Output

1 1
1 1
2 2
1 2
5 12
37381 52023

Note

Note

For the first test case, Alice is forced to choose $[1, 1]$ as it is the only valid option.

For the third test case, if Alice chooses $[2, 2]$, she is guaranteed to win (probability $1$); she can replace $l_1$ with $1$, after which Bob cannot make a valid move. Note that $[1, 1]$ would also be a valid winning answer here.

For the fourth test case, if Alice chooses $[1, 2]$, she achieves a winning probability of $2/3$. By contrast, choosing $[1, 1]$ or $[2, 2]$ would result in a winning probability of only $1/3$.