队友迷之stl骚操作

Morgana 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 <xxx, yyy>. If xix_ixi = xjx_jxj and yiy_iyi = yjy_jyj, then <xix_ixi, yiy_iyi> <xjx_jxj, yjy_jyj> are same features.

So if cat features are moving, we can think the cat is moving. If feature <aaa, bbb> is appeared in continuous frames, it will form features movement. For example, feature <aaa , bbb > is appeared in frame 2,3,4,7,82,3,4,7,82,3,4,7,8, then it forms two features movement 2−3−42-3-42−3−4 and 7−87-87−8 .

Now given the features in each frames, the number of features may be different, Morgana wants to find the longest features movement.

Input

First line contains one integer T(1≤T≤10)T(1 \le T \le 10)T(1≤T≤10) , giving the test cases.

Then the first line of each cases contains one integer nnn (number of frames),

In The next nnn lines, each line contains one integer kik_iki ( the number of features) and 2ki2k_i2ki intergers describe kik_iki features in ith frame.(The first two integers describe the first feature, the 333rd and 444th integer describe the second feature, and so on).

In each test case the sum number of features NNN will satisfy N≤100000N \le 100000N≤100000 .

Output

For each cases, output one line with one integers represents the longest length of features movement.

样例输入

1
8
2 1 1 2 2
2 1 1 1 4
2 1 1 2 2
2 2 2 1 4
0
0
1 1 1
1 1 1

样例输出

3

#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>PI;
int sum;
int n,m;
int ans=0;
void dg(map<PI,int>mm)
{
map<PI,int>mm2;
ans++;
if(ans>n)
return ;
int a,b;
scanf("%d",&m);
for(int i=1; i<=m; i++)
{
scanf("%d%d",&a,&b);
mm2[PI(a,b)]=mm[PI(a,b)]+1;
if(mm2[PI(a,b)]>sum)
sum=mm2[PI(a,b)];
}
dg(mm2);
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
sum=0;
ans=0;
map<PI,int>mp;
scanf("%d",&n);
/*for(int i=1;i<=n;i++)
{
int m;
scanf("%d")
}*/
dg(mp);
printf("%d\n",sum);
}
}