#include using namespace std; int h, w; int main(void) { cin >> h >> w; int cnt = 0; for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ char c; cin >> c; if(c == 'o') cnt += max(h-1-i, j)%2+1; } } if(cnt%3 == 0) cout << "YES" << endl; else cout << "NO" << endl; return 0; }