#include using namespace std; int n; string s[15]; int cnt = 0; int now = 0; int f[15][15]; void dfs(int x,int y){ if(s[x][y] == '#'){ return; } if(f[x][y] == 1){ if(x == 0 && y == 0 || x == n - 1 && y == n - 1){ }else{ return ; } } if(x == n - 1 && y == n - 1){ now++; cnt = max(cnt,now); dfs(0,0); now--; return ; } if(x >= n || y >= n){ return ; } f[x][y] = 1; dfs(x+1,y); dfs(x,y+1); f[x][y] = 0; } int main(){ int t; cin >> t; while(t--){ cnt = 0; now = 0; memset(f,0,sizeof(f)); scanf("%d",&n); for(int i = 0;i < n;i++){ cin >> s[i]; } dfs(0,0); printf("%d\n",cnt); } return 0; }