{"trustable":false,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e\nJohn and Johnny are playing a game and he wants you to help him with this. \nThis class is on art. Mr. Picasso gives every baby a piece of white drawing paper and let them paint on it.\n \u003cbr\u003e\n \u003cbr\u003eBaby Volcano is going to color the drawing paper black. For convenience, the drawing paper can be regarded as a Cartesian coordinate system, and initially, all points on it is white.\n \u003cbr\u003e\n \u003cbr\u003eBaby Volcano plans to paint the drawing paper in $n$ steps. In the $i$th step, he will color rectangular $R_i$ black, where the lower left corner of $R_i$ is $(l_i,0)$, the upper right corner of $R_i$ is $(r_i,h_i)$. \n \u003cbr\u003e\n \u003cbr\u003eLet $P_i$ be the drawing paper after the first $i$ steps, your task is to calculate the perimeter of black area on $P_i$.\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains a single integer $t(1 \\leq t \\leq 100)$, the number of testcases.\n\u003cbr\u003e\n\u003cbr\u003eFor each testcase, the first line contains a single integer $n(1 \\leq n \\leq 2 \\times 10^5)$, the number of steps.\n\u003cbr\u003e\n\u003cbr\u003eThen $n$ lines follow. Each line contains $3$ integers $l_i,r_i,h_i (1 \\leq l_i, \u0026lt; r_i \\leq 10^9, 1 \\leq h_i \\leq 10^9)$.\n\u003cbr\u003e\n\u003cbr\u003eThe input guarantees that there are no more than $3$ testcases with $n \u0026gt; 1000$."}},{"title":"Output","value":{"format":"HTML","content":"For each testcase, output $n$ lines. Each line contains a single integer, representing the perimeter of black area after the first $i$ steps."}},{"title":"Sample","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\u003e\u003cpre\u003e1\n6\n1 2 2\n3 4 3\n5 6 2\n1 4 1\n2 6 1\n3 7 4\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e\u003cpre\u003e6\n14\n20\n20\n20\n22\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}