#include #include using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 10000000 int main(){ int h,w; cin>>h>>w; vector S(h); rep(i,h)cin>>S[i]; int sum = 0; rep(i,h){ rep(j,w){ if(S[i][j]=='o'){ if((j+(h-1-i))%2==0)sum++; else sum += 2; } } } if(sum%3==0)cout<<"YES"<