using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (h, w) = (c[0], c[1]); var map = NArr(h); var dp = new long[2][][]; for (var i = 0; i < 2; ++i) { dp[i] = new long[h][]; for (var j = 0; j < h; ++j) dp[i][j] = Enumerable.Repeat(long.MinValue, w).ToArray(); } dp[0][0][0] = map[0][0]; for (var i = 0; i < h; ++i) for (var j = 0; j < w; ++j) { if (i + 1 < h) { if (dp[0][i][j] > map[i + 1][j]) dp[0][i + 1][j] = Math.Max(dp[0][i + 1][j], dp[0][i][j] + map[i + 1][j]); else dp[1][i + 1][j] = Math.Max(dp[1][i + 1][j], dp[0][i][j]); if (dp[1][i][j] > map[i + 1][j]) dp[1][i + 1][j] = Math.Max(dp[1][i + 1][j], dp[1][i][j] + map[i + 1][j]); } if (j + 1 < w) { if (dp[0][i][j] > map[i][j + 1]) dp[0][i][j + 1] = Math.Max(dp[0][i][j + 1], dp[0][i][j] + map[i][j + 1]); else dp[1][i][j + 1] = Math.Max(dp[1][i][j + 1], dp[0][i][j]); if (dp[1][i][j] > map[i][j + 1]) dp[1][i][j + 1] = Math.Max(dp[1][i][j + 1], dp[1][i][j] + map[i][j + 1]); } } WriteLine(Math.Max(dp[0][h - 1][w - 1], dp[1][h - 1][w - 1]) > map[h - 1][w - 1] ? "Yes" : "No"); } }