#include #include #include #include #define REP(i, n) for (int i = 0; i < (n); i++) using namespace std; int main() { int H, W; cin >> H >> W; vector S(H); REP(i, H) cin >> S[i]; int a[2] = {}; REP(i, H) REP(j, W) { if (S[i][j] == 'o') { a[(i + j) % 2] ^= 1; } } puts(a[0] == 0 && a[1] == 1 ? "NO" : "YES"); }