#include #define rep(i,n) for(ll i = 0; i < n; i++) //[0,n) #define srep(i,a,b) for(ll i = a; i < b; i++) //[a,b) #define all(A) (A).begin(),(A).end() #define rall(A) (A).rbegin(),(A).rend() #define pmt(A) next_permutation(all(A)) using namespace std; using ll = long long; using ull = unsigned long long; using P = pair; using pq = priority_queue,greater

>; ll inf = 1LL<<60; int iinf = (int)1e9+1; int mod9 = 998244353; int mod1 = 1000000007; struct Edge { int to; int cost; int from; }; bool compe(const Edge &e,const Edge &e2){ return e.cost < e2.cost; } using Graph = vector>; using SGraph = vector>; template int siz(T& a){return (int)a.size();} ll squa(ll a){ return a*a; } ll ceil(ll a,ll b){ return (a+b-1)/b; } int H,W,T; vector>> seen; int dx[5] = {0,0,0,-1,1}; int dy[5] = {0,1,-1,0,0}; void dfs(const vector &S,int y,int x,int t){ if(t > T) return; seen[t][y][x] = 1; rep(i,5){ int ny = y+dy[i],nx = x+dx[i]; if(ny < 0 || ny >= H || nx < 0 || nx >= W) continue; int c = S[ny][nx]-'0'; int mod = (-(t+1))%(c+1); while(mod < 0) mod += c+1; if(mod == 0) continue; if(seen[t+1][ny][nx]) continue; dfs(S,ny,nx,t+1); } } int main(void){ cin >> H >> W >> T; int sy,sx,gy,gx; cin >> sy >> sx >> gy >> gx; sx--; sy--; gy--; gx--; vector S(H); rep(i,H) cin >> S[i]; seen.assign(T+3,vector>(H,vector(W,0))); seen[1][sy][sx] = 1; dfs(S,sy,sx,1); bool ok = 0; srep(i,1,T+1+1) ok |= seen[i][gy][gx]; cout << (ok ? "Yes" : "No") << endl; }