Jumps on strip#646

Jumps on strip

1 second
122.174 megabytes
Hard

A horizontal strip of size 1 \times n is divided into cells of size 1 \times 1. A checker piece is initially placed in cell number .

On the first move, the piece may move one cell to the left or right. On the second move, it must move two cells in one direction (also either left or right), and so on: each subsequent move must cover one cell more than the previous move. The piece continues to move as long as no move causes it to go outside the strip.

Determine the maximal and minimal possible number of moves the piece can make.

Input

The first line contains a single integer (1 \le t \le 20), the number of test cases.

Each of the following lines contains two integers and (1 \le n \le 10^{18}, 1 \le s \le n), where is the number of cells in the strip and is the starting cell of the checker piece.

Output

For each test case, print two integers: the maximal and minimal possible number of moves the checker piece can make.

Examples

Example 1

Loading
Loading