#include <bits/stdc++.h>
using namespace std;
int DIR[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
vector<vector<int> > MAP;
class vec4 {
 public:
  int x, y, turns, dir;
  vec4(int ax, int ay, int aturns, int adir) {
    x = ax;
    y = ay;
    turns = aturns;
    dir = adir;
  }
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  MAP = vector<vector<int> >(n, vector<int>(m));
  pair<int, int> ini, fin;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      char c;
      cin >> c;
      if (c == '*')
        MAP[i][j] = 1;
      else if (c == 'S')
        ini = pair<int, int>(i, j);
      else if (c == 'T')
        fin = pair<int, int>(i, j);
    }
  }
  queue<vec4> Q;
  Q.push(vec4(ini.first, ini.second, 0, 0));
  Q.push(vec4(ini.first, ini.second, 0, 1));
  Q.push(vec4(ini.first, ini.second, 0, 2));
  Q.push(vec4(ini.first, ini.second, 0, 3));
  bool flag = false;
  vector<vector<int> > vis(n, vector<int>(m, 0)), turn(n, vector<int>(m, 10));
  while (!Q.empty()) {
    vec4 v = Q.front();
    Q.pop();
    if (v.turns > 2 || (vis[v.x][v.y] && turn[v.x][v.y] < v.turns)) continue;
    if (pair<int, int>(v.x, v.y) == fin) {
      flag = true;
      break;
    }
    vis[v.x][v.y] = 1;
    turn[v.x][v.y] = min(turn[v.x][v.y], v.turns);
    for (int i = 0; i < 4; ++i) {
      int dx = v.x + DIR[i][0], dy = v.y + DIR[i][1];
      if (dx >= 0 && dx < n && dy >= 0 && dy < m && !MAP[dx][dy]) {
        if (i == v.dir)
          Q.push(vec4(dx, dy, v.turns, i));
        else
          Q.push(vec4(dx, dy, v.turns + 1, i));
      }
    }
  }
  if (flag)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
