You will be given three pairs of integers, which denotes the starting and ending time in seconds of three classes.
The task is very simple. You have to assign three classrooms for the classes and find the total class time. Class time is when at least one class is running.
The first line will contain a positive integer T (1 ≤ T ≤ 100), denoting the number of test cases.
Each of the next T lines will contain 6 space separated positive integers denoting a1, b1, a2, b2, a3, b3 (0 ≤ a1, b1, a2, b2, a3, b3 ≤ 106).
Integers ai and bi are the starting and finishing time respectively of the i’th class.
For each test case print the time required.
1 1 2 3 4 5 6
Here the first class is from 1 to 2 inclusive, so the class time is 2. The second class is from 3 to 4 inclusive, so the class time is 2 and it is the same for the third one.