#include<stdio.h>
#include<math.h>
float max(int n,int arr[n][n]) {
	int i,j,ct;
	int value[n][n];
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			if (i == 0 && j == 0) 
				value[i][j] = arr[i][j];
			else if (i == 0) 
				value[i][j] = value[i][j-1] + arr[i][j];
			else if (j == 0) 
				value[i][j] = value[i-1][j] + arr[i][j];
			else 
			{
				if(value[i][j-1]>value[i-1][j])
					value[i][j] = value[i][j-1] + arr[i][j];
				else
					value[i][j] = value[i-1][j] + arr[i][j];
			}
		}
	}
	return (value[n-1][n-1]);
}

int main()
{
	int test,lp;
	scanf("%d",&test);
	for(lp=0;lp<test;lp++)
	{
	int n,i,j,ct;
	scanf("%d",&n);
	ct=1+(n-2)*2;
	int s[n][n];
	for(i=0;i<n;i++)
		for(j=0;j<n;j++)
			scanf("%d",&s[i][j]);
	float answer=max(n,s);
	if(answer>=0)
	printf("%f\n",answer*1.0/ct);
	else
		printf("Bad Judges\n");
	}
	return 0;
}