#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
    ll q; cin >> q;
    cin.ignore();
    for (ll _ = 1; _ <= q; _++)
    {
        
        string s; getline(cin, s);
        vector < ll > a;
        ll t = 0;

        for (char i : s)
        {
            if (i != ' ')
            {
                t++;
            }
            else
            {
                if (t > 0) a.push_back(t);
                t = 0;
            }
        }
        if (t > 0) a.push_back(t);
        ll _max = 1;
        ll tmp = 1;

        for (ll i = 1; i <= a.size(); i++)
        {
            if (a[i] == a[i - 1]) tmp++;
            else
            {
                tmp = 1;
            }
            _max = max(_max, tmp);
        }
        if (_ != q) cout << _max << endl;
    	else cout << _max;
    	
    }
	
}
