#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<cmath>
#include<string>
using namespace std;
typedef long long LL;
typedef unsigned long long ull;
const int inf = 0x3f3f3f3f;
const LL infll = 0x3f3f3f3f3f3f3f3f;
const LL mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1.0);
const int maxn = 1e5 + 5;
const int maxm = 1.5e7 + 5;
using namespace std;
int main()
{
int T, n;
string mp[105];
cin >> T;
while (T--)
{
int maxx = 0, cnt;
cin >> n;
for (int i = 0;i < n;i++)
{
cin >> mp[i];
}
for (int i = 0;i < n;i++)
{
cnt = 0;
for (int j = 0;j < n;j++)
{
if (mp[i] == mp[j])cnt++;
}
maxx = max(maxx, cnt);
}
cout << maxx << endl;
}
return 0;
}