G. Rock-Paper-Scissors
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

LittleV and Little$$$\Lambda$$$ are about to play a fun game of Rock-Paper-Scissors. However, the traditional version is too boring, so they developed a new card-based version of Rock-Paper-Scissors.

Specifically, LittleV and Little$$$\Lambda$$$ each have $$$n$$$ cards. LittleV has $$$r_1$$$ Rock cards, $$$s_1$$$ Scissors cards, and $$$p_1$$$ Paper cards, while Little$$$\Lambda$$$ has $$$r_2$$$ Rock cards, $$$s_2$$$ Scissors cards, and $$$p_2$$$ Paper cards. It is guaranteed that $$$n = r_1 + s_1 + p_1 = r_2 + s_2 + p_2$$$.

The game consists of $$$n$$$ rounds. In each round, both players select one card from their own hands to play. The outcome is determined by the rules of Rock-Paper-Scissors, and the two played cards are then discarded. If LittleV wins, the cumulative score increases by $$$+1$$$; if Little$$$\Lambda$$$ wins, the cumulative score decreases by $$$-1$$$; and in case of a tie, the cumulative score remains unchanged.

Naturally, LittleV wants to maximize the cumulative score, while Little$$$\Lambda$$$ wants to minimize it. Now, they want to know, under random play, what the possible maximum and minimum values of the cumulative score could be.

Input

The first line of input contains an integer $$$T$$$ ($$$1 \le T \le 10^4$$$), denoting the number of testcases.

For each testcase,

The input contains seven integers: $$$n,r_1,s_1,p_1,r_2,s_2,p_2$$$ ($$$0 \le n \le 10^9, 0 \le r_1, s_1, p_1, r_2, s_2, p_2 \le n,\\n = r_1 + s_1 + p_1 = r_2 + s_2 + p_2$$$), denoting the number of rounds, and the number of cards of each type for LittleV and Little$$$\Lambda$$$.

Output

For each testcase, output a single line containing two integers, denoting the maximum and minimum possible scores, respectively.

Example
Input
3
3 1 1 1 1 1 1
1 0 1 0 0 0 1
0 0 0 0 0 0 0
Output
3 -3
1 1
0 0