func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, sx, sy, dx, dy;   string s[1022];   bool vis[1002][1002][5][5];   bool f(int i, int j, int dir, int steps) {     if (i < 0 || j < 0 || i == n || j == m || steps > 2 || s[i][j] ==  *  ||         (dir != -1 && vis[i][j][dir][steps]))       return false;     if (dir != -1) vis[i][j][dir][steps] = 1;     if (i == dx && j == dy && steps <= 2) return true;     if (dir == -1) {       return f(i + 1, j, 2, steps) || f(i - 1, j, 0, steps) ||              f(i, j + 1, 1, steps) || f(i, j - 1, 3, steps);     } else {       if (dir == 0)         return f(i + 1, j, 2, steps + 1) || f(i - 1, j, 0, steps) ||                f(i, j + 1, 1, steps + 1) || f(i, j - 1, 3, steps + 1);       if (dir == 1)         return f(i + 1, j, 2, steps + 1) || f(i - 1, j, 0, steps + 1) ||                f(i, j + 1, 1, steps) || f(i, j - 1, 3, steps + 1);       if (dir == 2)         return f(i + 1, j, 2, steps) || f(i - 1, j, 0, steps + 1) ||                f(i, j + 1, 1, steps + 1) || f(i, j - 1, 3, steps + 1);       if (dir == 3)         return f(i + 1, j, 2, steps + 1) || f(i - 1, j, 0, steps) ||                f(i, j + 1, 1, steps + 1) || f(i, j - 1, 3, steps);     }     return false;   }   int main() {     cin >> n >> m;     for (int i = 0; i < n; i++) {       cin >> s[i];       for (int j = 0; j < s[i].size(); j++) {         if (s[i][j] ==  S ) {           sx = i;           sy = j;         }         if (s[i][j] ==  T ) {           dx = i;           dy = j;         }       }     }     memset(vis, 0, sizeof(vis));     if (f(sx, sy, -1, 0))       cout <<  YES n ;     else       cout <<  NO n ;   }   