func_code_string: #include <bits/stdc++.h>   using namespace std;   int h[4] = {0, 0, 1, -1};   int v[4] = {1, -1, 0, 0};   vector<vector<int> > adj;   bool *visited;   int num[501][501];   bool done = false;   int sourceR, sourceC, destR, destC;   void DFS(int vertix) {     if (!done) {       visited[vertix] = true;       for (int i = 0; i < adj[vertix].size(); i++) {         if (!done && visited[adj[vertix][i]] &&             adj[vertix][i] == num[destR - 1][destC - 1]) {           if (visited[vertix]) {             done = true;             cout <<  YES  << endl;             return;           }         }         if (!done && !visited[adj[vertix][i]]) {           DFS(adj[vertix][i]);         }       }     }   }   int main() {     int n, m;     cin >> n >> m;     visited = new bool[n * m];     vector<int> temp;     int cnt = 0;     char a[501][501];     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         adj.push_back(temp);         cin >> a[i][j];         visited[cnt] = false;         num[i][j] = cnt++;       }     }     cin >> sourceR >> sourceC >> destR >> destC;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (a[i][j] ==  X ) {           visited[num[i][j]] = true;         }         for (int k = 0; k < 4; k++) {           if (i + h[k] >= 0 && i + h[k] < n && j + v[k] >= 0 && j + v[k] < m) {             adj[num[i][j]].push_back(num[i + h[k]][j + v[k]]);           }         }       }     }     DFS(num[sourceR - 1][sourceC - 1]);     if (!done) {       cout <<  NO  << endl;     }     return 0;   }   