#include using namespace std; using ll = long long; using vll = vector; using vvll = vector; using vvvll = vector; #define all(A) A.begin(),A.end() #define rep(i, n) for (ll i = 0; i < (ll) (n); i++) bool chmax(ll& p, ll q) { if (p < q) { p = q; return 1; } else { return 0; } } bool chmin(ll& p, ll q) { if (p > q) { p = q; return 1; } else { return 0; } } int main() { ll H, W; cin >> H >> W; vvll A(H, vll(W)); rep(h, H)rep(w, W) { cin >> A[h][w]; } vvvll DP(H, vvll(W, vll(2, -1e18))); DP[0][0][0] = DP[0][0][1] = A[0][0]; vll dx = { 1,0 }; vll dy = { 0,1 }; rep(h, H) { rep(w, W) { rep(d, 2) { ll ny = h + dy[d]; ll nx = w + dx[d]; if (ny < 0 || ny >= H || nx < 0 || nx >= W)continue; rep(k, 1) { if(ny!=H-1||nx!=W-1)chmax(DP[ny][nx][k + 1], DP[h][w][k]); } rep(k, 2) { if (A[ny][nx] < DP[h][w][k]) { chmax(DP[ny][nx][k], DP[h][w][k] + A[ny][nx]); } } } } } bool C = false; rep(i, 2) { if (DP[H - 1][W - 1][i] >= 0)C = 1; } cout << (C ? "Yes" : "No") << endl; }