rt
#include<bits/stdc++.h>
using namespace std;
long long t,t_1,n,temp,maxn;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>t;
while(t--)
{
cin>>t_1;
maxn=0;
temp=0;
for(int i=1;i<=t_1;i++)
{
cin>>n;
if(n==1&&temp>maxn)
{
maxn=temp;
temp=0;
}
if(n==0)temp++;
}
if(temp>maxn)maxn=temp;
cout<<maxn<<"\n";
}
return 0;
}