#include <bits/stdc++.h>   using namespace std;   struct less_key {     bool operator()(pair<int64_t, int64_t> p1, pair<int64_t, int64_t> p2) {       return (p1.first > p2.first) ||              ((p1.first == p2.first) && (p1.second < p2.second));     }   };   struct pair_hash {     std::size_t operator()(const pair<int64_t, int64_t>& k) const {       return static_cast<size_t>(k.first ^ k.second);     }   };   const int64_t mod = 100000000007ll;   const int64_t inf = 10000000000000007ll;   int64_t n, m;   char a[10004][10004];   int64_t sx, sy;   int64_t tx, ty;   bool x1[10004], x2[10004];   bool _q1[10004], y2[10004];   bool check_x(int64_t x1, int64_t x2, int64_t y) {     bool f = 1;     int64_t q = x1 < x2 ? 1 : -1;     for (int64_t i = x1;; i += q) {       if (a[i][y] ==  * ) {         f = 0;         break;       }       if (i == x2) {         break;       }     }     return f;   }   bool check_y(int64_t _q1, int64_t y2, int64_t x) {     bool f = 1;     int64_t q = _q1 < y2 ? 1 : -1;     for (int64_t i = _q1;; i += q) {       if (a[x][i] ==  * ) {         f = 0;         break;       }       if (i == y2) {         break;       }     }     return f;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> n >> m;     for (int64_t i = 0; i < n; i++) {       for (int64_t j = 0; j < m; j++) {         cin >> a[i][j];         if (a[i][j] ==  S ) {           sx = i;           sy = j;         } else if (a[i][j] ==  T ) {           tx = i;           ty = j;         }       }     }     if (sx == tx) {       bool f = 1;       int64_t q = sy < ty ? 1 : -1;       for (int64_t i = sy; i != ty; i += q) {         if (a[sx][i] ==  * ) {           f = 0;           break;         }       }       if (f) {         cout <<  YES ;         return 0;       }     }     if (sy == ty) {       bool f = 1;       int64_t q = sx < tx ? 1 : -1;       for (int64_t i = sx; i != tx; i += q) {         if (a[i][sy] ==  * ) {           f = 0;           break;         }       }       if (f) {         cout <<  YES ;         return 0;       }     }     bool f = 0;     for (int64_t i = 0; i < n && !f; i++) {       if (check_x(i, sx, sy) && check_x(i, tx, ty) && check_y(sy, ty, i)) {         f = 1;       }     }     for (int64_t j = 0; j < m && !f; j++) {       if (check_y(j, sy, sx) && check_y(j, ty, tx) && check_x(sx, tx, j)) {         f = 1;         break;       }     }     cout << (f ?  YES  :  NO );     return 0;   }   