#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) void solve() { ll n; cin >> n; vector s(n); rep(i, n) cin >> s[i]; if (n % 2 == 1) { cout << "Yes\n"; return; } ll x = 0; rep(i, n) { rep(j, n) { ll k = n - j - 1; if (j < k && s[i][j] != s[i][k]) x++; } } cout << ((x % 2 == 0) ? "Yes" : "No") << '\n'; } int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); int T = 1; for (int t = 0; t < T; t++) { solve(); } return 0; }