#include using namespace std; int h, w; char c[205][205]; 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 += (j-1-i+w)%2+1; } } if(cnt%3 == 0) cout << "YES" << endl; else cout << "NO" << endl; return 0; }