{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThere are $$$n$$$ rectangle radar scanners on the ground. The sides of them are all paralleled to the axes. The $$$i$$$-th scanner\u0027s bottom left corner is square $$$(a_i,b_i)$$$ and its top right corner is square $$$(c_i,d_i)$$$. Each scanner covers some squares on the ground.\u003c/p\u003e\u003cp\u003eYou can move these scanners for many times. In each step, you can choose a scanner and move it one square to the left, right, upward or downward.\u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/9b5ec41c27aa3819ec1ee47520e27b41?v\u003d1714427520\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003c/center\u003e\u003cp\u003eToday, the radar system is facing a critical low-power problem. You need to move these scanners such that there exists a square covered by all scanners.\u003c/p\u003e\u003cp\u003eYour task is to minimize the number of move operations to achieve the goal.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input contains an integer $$$T(1\\leq T\\leq 1000)$$$, denoting the number of test cases.\u003c/p\u003e\u003cp\u003eIn each test case, there is one integer $$$n(1\\leq n\\leq 100000)$$$ in the first line, denoting the number of radar scanners.\u003c/p\u003e\u003cp\u003eFor the next $$$n$$$ lines, each line contains four integers $$$a_i,b_i,c_i,d_i(1\\leq a_i,b_i,c_i,d_i\\leq 10^9,a_i\\leq c_i,b_i\\leq d_i)$$$, denoting each radar scanner.\u003c/p\u003e\u003cp\u003eIt is guaranteed that $$$\\sum n\\leq 10^6$$$.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eFor each test case, print a single line containing an integer, denoting the minimum number of steps.\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1\n2\n2 2 3 3\n4 4 5 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}