#include #include using namespace std; using namespace atcoder; //const long nPrime = 1000000007; //const long nPrime = 998244353; typedef long long ll; int main() { ll h,w; cin >> h >> w; vector>> vvviDP(h+1,vector>(w+1,vector(2,0))); ll ahw; for(ll i = 1; i <= h; i++){ for(ll j = 1; j <= w; j++){ ll a; cin >> a; if(i == 1 && j == 1){ vvviDP[i][j][0] = a; continue; } if(i == h && j == w){ ahw = a; } if(vvviDP[i][j-1][0] > a){ vvviDP[i][j][0] = max(vvviDP[i][j][0], vvviDP[i][j-1][0]+a); } else { vvviDP[i][j][1] = max(vvviDP[i][j][1], vvviDP[i][j-1][0]); } if(vvviDP[i][j-1][1] > a){ vvviDP[i][j][1] = max(vvviDP[i][j][1], vvviDP[i][j-1][1]+a); } if(vvviDP[i-1][j][0] > a){ vvviDP[i][j][0] = max(vvviDP[i][j][0], vvviDP[i-1][j][0]+a); } else { vvviDP[i][j][1] = max(vvviDP[i][j][1], vvviDP[i-1][j][0]); } if(vvviDP[i-1][j][1] > a){ vvviDP[i][j][1] = max(vvviDP[i][j][1], vvviDP[i-1][j][1]+a); } } } if(vvviDP[h][w][0] > ahw || vvviDP[h][w][1] > ahw){ cout << "Yes" << endl; }else { cout << "No" << endl; } return 0; }