#include #include #include #include using namespace std; int T,n,ans; bool ch[15][15]; bool a[15][15]; bool dfs1(int x,int y) { if(x>n||y>n) return false; if(ch[x][y]==true) return false; if(x==n&&y==n){ans++;return true;} if(dfs1(x,y+1)){a[x][y]=true;return true;} if(dfs1(x+1,y)){a[x][y]=true;return true;} return false; } bool dfs2(int x,int y) { if(x>n||y>n) return false; if(ch[x][y]==true) return false; if(a[x][y]==true) return false; if(x==n&&y==n){ans++;return true;} if(dfs2(x+1,y)) return true; if(dfs2(x,y+1)) return true; return false; } int main() { scanf("%d",&T); while(T--) { memset(ch,0,sizeof(ch)); memset(a,0,sizeof(a)); scanf("%d",&n); ans=0; for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) { char az; cin>>az; if(az=='#') ch[i][j]=true; } if(ch[1][1]==true){puts("0");continue;} dfs1(1,2); dfs2(2,1); printf("%d\n",ans); } return 0; }