In a Tin Cutting factory there is a machine for cutting parts from tin plates. It has an extraordinarily sharp knife able to make horizontal or vertical segment cuts in the tin plates. Each cutting process consists of a sequence of such cuts. Each segment cut is given by its endpoints that are always located inside the tin plate. During the cutting process some parts of tin plate can fall out and so some holes in the plate can emerge. Factory management needs to predict the length of visible border lines at the end of the given sequence of cuts. Write a program that answers this question. Here are four examples: The first row in the picture are four cuttings and the second row contains their corresponding resulting plates. Each gray area is a separate hole, and thick lines are visible border lines after cutting. There are 2, 2, 1, 1 holes respectively (from left to right), and the length of visible border lines are 8, 26, 12, 20 respectively. Input The first line of input contains a single integer T (T ≤ 100), the number of test cases. The first line of each test case contains an integer n (1 ≤ n ≤ 100), the number of segment cuts. Each of the following n lines describe a segment cut with four integers x1, y1, x2, y2 that means a segment cut from (x1,y1) to (x2, y2) (0 ≤ x1, y1, x2, y2 ≤ 10000). The segment is always horizontal or vertical. Output For each test case, print the total length of the border lines. Sample Input 4 6 0010 1012 1222 2221 2101
2/2 0100 9 0040 4044 4404 0400 6181 8183 8363 6361 2272 8 0131 3132 3202 0201 1020 2023 2313 1310 8 0141 4144 4404 0401 3060 6062 6232 3230 Sample Output 8 26 12 20