#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-6;
const long double pi = acos(-1);
const long long oo = 1e9;
const long long N = 1e5 + 10;
const long long MOD = 1000000007;
int main() {
  long long n, m, a, b, c, d;
  cin >> n >> m;
  char v[n][m];
  bool vis[n][m];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cin >> v[i][j];
      vis[i][j] = false;
      if (v[i][j] == 'S') {
        a = i;
        b = j;
      }
      if (v[i][j] == 'T') {
        c = i;
        d = j;
      }
    }
  }
  stack<pair<long long, long long>> s;
  s.push({a, b});
  vis[a][b] = true;
  while (!s.empty()) {
    pair<long long, long long> t = s.top();
    s.pop();
    if (t.first + 1 < n && v[t.first + 1][t.second] != '*' &&
        !vis[t.first + 1][t.second]) {
      vis[t.first + 1][t.second] = true;
      s.push({t.first + 1, t.second});
    }
    if (t.first - 1 >= 0 && v[t.first - 1][t.second] != '*' &&
        !vis[t.first - 1][t.second]) {
      vis[t.first - 1][t.second] = true;
      s.push({t.first - 1, t.second});
    }
    if (t.second + 1 < m && v[t.first][t.second + 1] != '*' &&
        !vis[t.first][t.second + 1]) {
      vis[t.first][t.second + 1] = true;
      s.push({t.first, t.second + 1});
    }
    if (t.second - 1 >= 0 && v[t.first][t.second - 1] != '*' &&
        !vis[t.first][t.second - 1]) {
      vis[t.first][t.second - 1] = true;
      s.push({t.first, t.second - 1});
    }
  }
  if (vis[c][d]) {
    if (c < a) {
      swap(c, a);
      swap(b, d);
    }
    set<pair<long long, long long>> g, x;
    for (long long i = d; i < m; i++) {
      if (v[c][i] == '*') break;
      g.insert({c, i});
    }
    for (long long i = d; i >= 0; i--) {
      if (v[c][i] == '*') break;
      g.insert({c, i});
    }
    for (long long i = c; i < n; i++) {
      if (v[i][d] == '*') break;
      x.insert({i, d});
    }
    for (long long i = c; i >= 0; i--) {
      if (v[i][d] == '*') break;
      x.insert({i, d});
    }
    bool wrongAnswer = false;
    for (long long i = b; i < m && v[a][i] != '*'; i++) {
      for (long long j = a; j < n && v[j][i] != '*'; j++) {
        if (g.count({j, i}) == 1) {
          wrongAnswer = true;
          break;
        }
      }
    }
    for (long long i = b; i >= 0 && v[a][i] != '*'; i--) {
      for (long long j = a; j < n && v[j][i] != '*'; j++) {
        if (g.count({j, i}) == 1) {
          wrongAnswer = true;
          break;
        }
      }
    }
    for (long long i = a; i < n && v[i][b] != '*'; i++) {
      for (long long j = b; j < m && v[i][j] != '*'; j++) {
        if (x.count({i, j}) == 1) {
          wrongAnswer = true;
          break;
        }
      }
    }
    for (long long i = a; i < n && v[i][b] != '*'; i++) {
      for (long long j = b; j >= 0 && v[i][j] != '*'; j--) {
        if (x.count({i, j}) == 1) {
          wrongAnswer = true;
          break;
        }
      }
    }
    for (long long i = a; i >= 0 && v[i][b] != '*'; i--) {
      for (long long j = b; j < m && v[i][j] != '*'; j++) {
        if (x.count({i, j}) == 1) {
          wrongAnswer = true;
          break;
        }
      }
    }
    for (long long i = a; i >= 0 && v[i][b] != '*'; i--) {
      for (long long j = b; j >= 0 && v[i][j] != '*'; j--) {
        if (x.count({i, j}) == 1) {
          wrongAnswer = true;
          break;
        }
      }
    }
    if (wrongAnswer) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
