#include"bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; using pii = pair; using pll = pair; #define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++) #define REP(i,n) FOR((i),0,(n)) #define WAITING(str) int str;std::cin>>str; #define DEBUGING(str) cout<< #str << " " str<= 0; } int main() { ll H, W; cin >> H >> W; ll cnt = 0; ll all = 0; ll even = 0; REP(i, H) { string s; cin >> s; REP(j, W) if (s[j] == 'o') { cnt++; ll num = (H - 1 - i) + j + 1; all += num; if (num % 2 == 0)even++; } } //cout << all << " " << even << endl; bool res1 = all % 2 == 0 ? func(even) : cnt - even > 0; bool res2 = even % 2 == 0; cout << (res1&&res2 ? "NO" : "YES") << endl; return 0; }