AcCode:
//数组开的过大也会影响时间
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int ans, tot;
int Trie[400001][65];
int v[400001];
void Insert(char *s)
{
int len = strlen(s);
int root = 0;
for(int i = 0; i < len; i++){
int id = s[i] - '0';
if(!Trie[root][id]){
Trie[root][id] = tot++;
}
root = Trie[root][id];
v[root]++;
ans = max(ans, v[root]*(i+1));
}
}
int main()
{
int T, n;
char str[210];
scanf("%d", &T);
while(T--){
tot = 1;
memset(Trie, 0, sizeof(Trie));
memset(v, 0, sizeof(v));
ans = 0;
scanf("%d", &n);
for(int i = 0; i < n; i++){
scanf("%s", str);
Insert(str);
}
cout << ans << endl;
}
return 0;
}