#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:128777216")
using namespace std;
template <class T, class Q>
class hash_map : unordered_map<T, Q> {};
template <class T>
int size(const T &a) {
  return int(a.size());
}
template <class T>
T abs(const T &a) {
  return (a < 0 ? -a : a);
}
template <class T>
T sqr(const T &a) {
  return a * a;
}
long long mod = int(1e9 + 7.1);
template <class T>
inline T msum(T a, T b) {
  return (a + b < mod ? a + b : a + b - mod);
}
template <class T>
inline void madd(T &a, T b) {
  a = msum(a, b);
}
vector<pair<int, int> > dir = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
vector<int> d(vector<string> &a, int i, int j) {
  vector<int> r(4, 0);
  for (int d = 0; d < 4; ++d) {
    int row = i + dir[d].first, col = j + dir[d].second;
    int &cur = r[d];
    while (row >= 0 && col >= 0 && row < a.size() && col < a[0].size() &&
           a[row][col] != '*') {
      row += dir[d].first;
      col += dir[d].second;
      ++cur;
    }
  }
  return r;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<string> a(n);
  for (string &s : a) {
    cin >> s;
  }
  int si, sj;
  int ti, tj;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (a[i][j] == 'S') {
        si = i;
        sj = j;
      } else if (a[i][j] == 'T') {
        ti = i;
        tj = j;
      }
    }
  }
  vector<int> ds = d(a, si, sj);
  vector<int> dt = d(a, ti, tj);
  bool good = false;
  for (int i = max(si - ds[0], ti - dt[0]);
       !good && i <= min(si + ds[1], ti + dt[1]); ++i) {
    good = true;
    for (int j = min(sj, tj); j <= max(sj, tj); ++j) {
      if (a[i][j] == '*') {
        good = false;
        break;
      }
    }
  }
  for (int j = max(sj - ds[2], tj - dt[2]);
       !good && j <= min(sj + ds[3], tj + dt[3]); ++j) {
    good = true;
    for (int i = min(si, ti); i <= max(si, ti); ++i) {
      if (a[i][j] == '*') {
        good = false;
        break;
      }
    }
  }
  cout << (good ? "YES" : "NO") << endl;
  return 0;
}
