#include #include #include #include #include #include #include #include #include #include #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define endl "\n" //#define int long long using namespace std; typedef long long ll; const int inf=0x3f3f3f3f; const int maxn=1010; const int maxe=20010; int n,m,k; int head[maxn],cnt; struct Edge{ int v; int w; int next; }edge[maxe]; int deep[maxn]; int now[maxe]; void init(){ memset(head,-1,sizeof(head)); cnt=0; return ; } inline void add(int u,int v,int w){ edge[cnt].v=v; edge[cnt].w=w; edge[cnt].next=head[u]; head[u]=cnt++; } inline void addd(int u,int v,int w){ add(u,v,w); add(v,u,0); } inline bool bfs(int s,int t){ memset(deep,0x3f,sizeof(deep)); queueq; q.push(s);deep[s] = 0;now[s] = head[s]; while(q.size()){ int x = q.front();q.pop(); for(int i=head[x];~i;i=edge[i].next){ int y=edge[i].v; if(edge[i].w>0&&deep[y]==inf){ q.push(y); now[y]=head[y]; deep[y]=deep[x]+1; if(y==t) return 1; } } } return 0; } ll dfs(int x,int t,int flow){ if(x==t) return flow; ll ans = 0,k,i; for(i=now[x];~i&&flow;i=edge[i].next){ now[x]=i; int y=edge[i].v; if(edge[i].w>0&&(deep[y]==deep[x]+1)){ k=dfs(y,t,min(flow,edge[i].w)); if(!k) deep[y]=inf; edge[i].w-=k; edge[i^1].w+=k; ans+=k; flow-=k; } } return ans; } ll dinic(int s,int t){ ll maxflow=0; while(bfs(s,t)) maxflow+=dfs(s,t,inf); return maxflow; } int no(int x,int y){ return (x-1)*n+y; } char mp[15][15]; void solve(){ init(); cin>>n; for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) cin>>mp[i][j]; for(int i=1;i<=n;i++) for(int j=1;j<=n;j++){ if(mp[i][j]=='.'){ if(j>tn; while(tn--){ solve(); } }