#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- int N,M; char S[202][202][202]; int B[202][202]; int C[202][202]; int ok(int a,int b) { int y,x,i; FOR(y,N) FOR(x,N) B[y][x]=(S[a][y][x]=='#')^(S[b][y][x]=='#'); FOR(y,N-1) FOR(x,N-1) { C[y][x]=B[y][x]^B[y][x+1]^B[y+1][x]^B[y+1][x+1]; } FOR(y,N-1) if(C[y][0]) { FOR(i,y+1) C[y-i][i]^=1; } FOR(x,N-1) if(C[N-2][x]) { for(i=0;x+i