#include using namespace std; int main(){ unsigned long N, M; cin >> N >> M; string s; unsigned long a{0}, c{0}; for(unsigned long i = 0; i < N; ++i){ cin >> s; for(unsigned long j = 0; j < M; ++j){ if(s[j] == 'o'){ a += (N - i - 1) + (M - j - 1); c ^= 1; } } } puts(c & 1 ? "NO" : a & 1 ? "YES" : "NO"); }