#include using namespace std; inline bool in_grid(int i, int j, int h, int w) { return 0 <= i && i < h && 0 <= j && j < w; } const int di[] = {0, 1, -1, 0, 0}; const int dj[] = {0, 0, 0, 1, -1}; void solve(){ int h, w, t; cin >> h >> w >> t; pair s, g; cin >> s.first >> s.second >> g.first >> g.second; --s.first; --s.second; --g.first; --g.second; vector> a(h, vector(w)); for(int i = 0;i < h; ++i){ for(int j = 0;j < w; ++j){ cin >> a[i][j]; a[i][j] -= '0'; } } vector b = a; vector ok(h, vector(w)); ok[s.first][s.second] = true; for(int ii = 1;ii < t; ++ii){ for(int i = 0;i < h; ++i){ for(int j = 0;j < w; ++j){ b[i][j] = (b[i][j] - 1) % (a[i][j] + 1); if(b[i][j] < 0)b[i][j] += a[i][j] + 1; } } vector nok(h, vector(w)); for(int i = 0;i < h; ++i){ for(int j = 0;j < w; ++j){ if(!ok[i][j])continue; for(int d = 0;d < 5; ++d){ int ni = i + di[d]; int nj = j + dj[d]; if(!in_grid(ni, nj, h, w))continue; if(b[ni][nj] == 0)continue; nok[ni][nj] = true; } } } ok = move(nok); if(ok[g.first][g.second]){ cout << "Yes" << endl; return; } } cout << "No" << endl; } int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout<