#include<iostream>
#include<algorithm>
using namespace std;
int m,n,t,c;
int h[110],dp[110];
int main()
{
cin>>m;
while(m--)
{
t=0;
cin>>n;
for(int i=1; i<=n; i++)
{
cin>>h[i];
dp[i]=1;
}
for(int i=1; i<=n; i++)
{
for(int j=1; j<i; j++)
{
if(h[j]<=h[i])
{
dp[i]=max(dp[i],dp[j]+1);
}
}
}
for(int i=1; i<=n; i++)
{
t=max(t,dp[i]);
}
cout<<t<<' ';
for(int i=1; i<=n; i++)
{
if(dp[i]==t)
{
c++;
}
}
cout<<c<<endl;
}
return 0;
}