#include <iostream>
using namespace std;
int main()
{
int n,m;
while(cin>>n)
{
for(int i=0; i<n; i++)
{
cin>>m;
int a[m],b[m],suma=0,sumb=0,avg,best;
for(int j=0; i<m; j++)
{
cin>>a[j]>>b[j];
suma=suma+a[j];
sumb=sumb+b[j];
if(j!=0)
{
if((a[j+1]>a[j]) || ((a[j+i]==a[j])&&(b[j+1]>b[j])) ) best=j;
else if((a[j+1]<a[j]) || ((a[j+i]==a[j])&&(b[j+1]<b[j]))) best=j+1;
}
if(j==m-1)
{
avg=(suma*60+sumb)/m;
cout<<"Track "<<i+1<<":"<<endl<<"Best Lap: "<<a[best]<<" minute(s) "<<b[best]<<" second(s)."<<endl;
cout<<"Average: "<<avg/60<<" minute(s) "<<avg%60<<" second(s)."<<endl;
}
}
}
}
}
for(int j=0; j<m; j++)