Solve the programming task below in a Python markdown code block.
Chef has two ranges [A, B] and [C, D]. Chef needs to find the number of integers that belong to at least one of the ranges.

Note: A range [P, Q] contains all the integers \{P, P+1, P+2, \dots, Q-1, Q\}.

------ Input Format ------ 

- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of a single line containing 4 integers A, B, C, and D, as mentioned in the statement.

------ Output Format ------ 

For each test case, output on a new line, the number of integers that belong to at least one of the ranges.

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$1 ≤ A ≤ B ≤ 8$
$1 ≤ C ≤ D ≤ 8$

----- Sample Input 1 ------ 
4
1 3 5 5
3 8 2 5
1 8 4 6
5 5 5 5

----- Sample Output 1 ------ 
4
7
8
1

----- explanation 1 ------ 
Test case $1$: There are $4$ integers that belong to at least one of the ranges. These are $1, 2, 3,$ and $5$.

Test case $2$: There are $7$ integers that belong to at least one of the ranges. These are $2, 3, 4, 5, 6, 7,$ and $8$.

Test case $3$: There are $8$ integers that belong to at least one of the ranges. These are $1, 2, 3, 4, 5, 6, 7,$ and $8$.

Test case $4$: There is only $1$ integer that belong to at least one of the ranges. That integer is $5$.