#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long double pii = 3.14159265359;
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 1001;
vector<int> grd[MX];
vector<int> dir[MX], mvs[MX];
int dx[] = {0, 0, -1, 1, 1, 1, -1, -1}, dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
int H, W;
inline bool isValid(int x, int y) {
  if (x >= 0 && x < H && y >= 0 && y < W && !grd[x][y]) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> H >> W;
  int sx, sy, ex, ey;
  for (int y = 0; y < (H); y++) {
    string str;
    cin >> str;
    for (int x = 0; x < (W); x++) {
      mvs[y].push_back(INT_MAX);
      dir[y].push_back(0);
      if (str[x] == '*')
        grd[y].push_back(1);
      else
        grd[y].push_back(0);
      if (str[x] == 'S')
        sx = y, sy = x;
      else if (str[x] == 'T')
        ex = y, ey = x;
    }
  }
  deque<pair<int, int> > q;
  mvs[sx][sy] = 0;
  for (int x = 0; x < (4); x++) {
    int vx = sx + dx[x], vy = sy + dy[x];
    if (isValid(vx, vy)) {
      q.push_front({vx, vy});
      dir[vx][vy] = x;
      mvs[vx][vy] = 0;
      if (vx == ex && vy == ey) {
        cout << "YES";
        return 0;
      }
    }
  }
  while ((int)(q).size() != 0) {
    pair<int, int> S = q.front();
    q.pop_front();
    if (isValid(S.first + dx[dir[S.first][S.second]],
                S.second + dy[dir[S.first][S.second]])) {
      pair<int, int> v = {S.first + dx[dir[S.first][S.second]],
                          S.second + dy[dir[S.first][S.second]]};
      if (mvs[v.first][v.second] > mvs[S.first][S.second]) {
        dir[v.first][v.second] = dir[S.first][S.second];
        mvs[v.first][v.second] = mvs[S.first][S.second];
        q.push_front(v);
      }
    }
    for (int x = 0; x < (4); x++) {
      if (x == dir[S.first][S.second]) continue;
      pair<int, int> v = {S.first + dx[x], S.second + dy[x]};
      if (!isValid(v.first, v.second)) continue;
      if (mvs[v.first][v.second] >= 1 + mvs[S.first][S.second]) {
        dir[v.first][v.second] = x;
        mvs[v.first][v.second] = 1 + mvs[S.first][S.second];
        q.push_back(v);
      }
    }
  }
  if (mvs[ex][ey] > 2)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
