{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eMorgana is learning computer vision, and he likes cats, too. One day he wants to find the cat movement from a cat video. To do this, he extracts cat features in each frame. A cat feature is a two-dimension vector \u0026lt;$x$, $y$\u0026gt;. If $x_i$ \u003d $x_j$ and $y_i$ \u003d $y_j$, then \u0026lt;$x_i$, $y_i$\u0026gt; \u0026lt;$x_j$, $y_j$\u0026gt; are same features.\u003c/p\u003e\u003cp\u003eSo if cat features are moving, we can think the cat is moving. If feature \u0026lt;$a$, $b$\u0026gt; is appeared in continuous frames, it will form features movement. For example, feature \u0026lt;$a$ , $b$ \u0026gt; is appeared in frame $2,3,4,7,8$, then it forms two features movement $2-3-4$ and $7-8$ .\u003c/p\u003e\u003cp\u003eNow given the features in each frames, the number of features may be different, Morgana wants to find the longest features movement.\u003c/p\u003e\u003ch3\u003eInput\u003c/h3\u003e\u003cp\u003eFirst line contains one integer $T(1 \\le T \\le 10)$ , giving the test cases.\u003c/p\u003e\u003cp\u003eThen the first line of each cases contains one integer $n$ (number of frames),\u003c/p\u003e\u003cp\u003eIn The next $n$ lines, each line contains one integer $k_i$ ( the number of features) and $2k_i$ intergers describe $k_i$ features in ith frame.(The first two integers describe the first feature, the $3$rd and $4$th integer describe the second feature, and so on).\u003c/p\u003e\u003cp\u003eIn each test case the sum number of features $N$ will satisfy $N \\le 100000$ .\u003c/p\u003e\u003ch3\u003eOutput\u003c/h3\u003e\u003cp\u003eFor each cases, output one line with one integers represents the longest length of features movement.\u003c/p\u003e"}},{"title":"Sample 1","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\n8\n2 1 1 2 2\n2 1 1 1 4\n2 1 1 2 2\n2 2 2 1 4\n0\n0\n1 1 1\n1 1 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}}]}