#include using namespace std; #ifdef LOCAL #include "algo/debug.h" #else #define debug(...) (void(0)) #endif using ll = long long; using ld = long double; template using prique = std::priority_queue, std::greater>; template bool chmin(T& x, const T& y) { return (x > y ? x = y, true : false); } template bool chmax(T& x, const T& y) { return (x < y ? x = y, true : false); } #define rep1(a) for (ll _i = 0; _i < (ll)(a); _i++) #define rep2(i, a) for (ll i = 0; i < (ll)(a); i++) #define rep3(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) #define rep4(i, a, b, c) for (ll i = (ll)(a); (0 < (ll)(c) ? i < (ll)(b) : i > (ll)(b)); i += (ll)(c)) #define overload4(a, b, c, d, e, ...) e #define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) #define all(x) std::begin(x), std::end(x) #define rall(x) std::rbegin(x), std::rend(x) #define pb push_back void run_case() { int N; cin >> N; vector A(N); rep(i, N) cin >> A[i]; int w = 0, b = 0; rep(i, N) { rep(j, N/2) if(A[i][j] != A[i][N - j - 1]) { if(A[i][j] == '#') b++; else w++; } } w += b; if(w & 1) cout << "No\n"; else cout << "Yes\n"; } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); // std::fixed(std::cout).precision(16); int T = 1; // cin >> T; while (T--) run_case(); return 0; }