#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1E9 + 7, INF = 2E18 + 5;
const double PI = 2 * acos(0.0);
const long double EPS = 1.0E-14;
struct Point {
  int x, y;
  char ch;
  Point(int xx, int yy, char cc) { x = xx, y = yy, ch = cc; }
};
int dx[] = {+0, +0, +1, -1};
int dy[] = {+1, -1, +0, +0};
string s[1005];
int dist[1005][1005][30];
int row, col;
deque<Point> dq;
bool valid(int x, int y) {
  if (x >= 0 and x < row and y >= 0 and y < col and s[x][y] != '*') return true;
  return false;
}
void bfs(int x1, int y1) {
  int px, py, vx, vy, cost;
  char pd, vd;
  for (int i = 0; i < 4; i++) {
    px = x1 + dx[i], py = y1 + dy[i];
    if (valid(px, py)) {
      if (dy[i] == 1)
        vd = 'R';
      else if (dy[i] == -1)
        vd = 'L';
      else if (dx[i] == 1)
        vd = 'D';
      else if (dx[i] == -1)
        vd = 'U';
      dist[px][py][vd - 'A'] = 0;
      dq.push_front(Point(px, py, vd));
    }
  }
  while (!dq.empty()) {
    px = dq.front().x, py = dq.front().y, pd = dq.front().ch;
    dq.pop_front();
    for (int i = 0; i < 4; i++) {
      vx = px + dx[i], vy = py + dy[i];
      if (valid(vx, vy)) {
        if (dy[i] == 1)
          vd = 'R';
        else if (dy[i] == -1)
          vd = 'L';
        else if (dx[i] == 1)
          vd = 'D';
        else if (dx[i] == -1)
          vd = 'U';
        if (vd == pd)
          cost = 0;
        else
          cost = 1;
        if (dist[vx][vy][vd - 'A'] > dist[px][py][pd - 'A'] + cost) {
          dist[vx][vy][vd - 'A'] = dist[px][py][pd - 'A'] + cost;
          if (cost == 0)
            dq.push_front(Point(vx, vy, vd));
          else
            dq.push_back(Point(vx, vy, vd));
        }
      }
    }
  }
}
int main() {
  cin >> row >> col;
  int x1, y1, x2, y2;
  for (int i = 0; i < row; i++) {
    cin >> s[i];
    for (int j = 0; j < col; j++) {
      if (s[i][j] == 'S')
        x1 = i, y1 = j;
      else if (s[i][j] == 'T')
        x2 = i, y2 = j;
      for (int k = 0; k < 30; k++) {
        dist[i][j][k] = 1E9;
      }
    }
  }
  bfs(x1, y1);
  for (int i = 0; i < 30; i++) {
    if (dist[x2][y2][i] <= 2) {
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
