#include "bits/stdc++.h" using namespace std; void solve() { int h, w; cin >> h >> w; vector g(h); for (auto &l : g) cin >> l; reverse(g.begin(), g.end()); int oc = 0, ec = 0; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (g[i][j] == 'o') { ((i + j + 1) % 2 ? oc : ec) += 1; } } } cout << ((oc + ec + 1) % 2 ? "YES" : "NO") << endl; } int main() { solve(); //cout << "yui(*-v・)yui" << endl; return 0; }