import sequtils,strutils,algorithm,heapqueue proc r():any=stdin.readLine.split.map parseInt let(n,v,ox,oy)=(let t=r();(t[0],t[1],t[3]-1,t[2]-1)) let L = newSeqWith(n,r()) type Field=tuple[x,y,v:int] proc `<`(x,y:Field):bool=x.v>y.v proc T(sx,sy,sv,c:int)= var(C,O)=(newSeqWith(n,newSeq[bool](n)),newHeapQueue[Field]()) O.push((sx,sy,sv)) while O.len>0: let (x,y,v)=O.pop() if C[x][y]:continue C[x][y]=true if c==1 and x==ox and y==oy: T(x,y,v*2,0) continue for d in [(0,1),(1,0),(0,-1),(-1,0)]: let(nx,ny)=(d[0]+x,d[1]+y) if nx<0 or ny<0 or nx>=n or ny>=n :continue var n_v = v - L[nx][ny] if n_v <= 0 : continue if C[nx][ny]: continue O.push((nx,ny,n_v)) if nx == n-1 and ny == n-1:quit "YES",0 T(0,0,v,1) echo "NO"