#include <bits/stdc++.h>
using namespace std;
const long long MXN = 1e6 + 1;
const long long MNN = 1e3 + 1;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long long MAGIC = 1000;
const long double EPS = 1e-9;
const long double PI = 3.1415926536;
const string TIME = "rovno_ushten_push_ketti";
long long n, m, sx, fx, sy, fy;
char a[MNN][MNN];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cin >> a[i][j];
      if (a[i][j] == 'S') {
        sx = i, sy = j;
      }
      if (a[i][j] == 'T') {
        fx = i, fy = j;
      }
    }
  }
  for (long long i = 1; i <= m; i++) {
    bool ok1 = 1, ok2 = 1, ok3 = 1;
    for (long long j = min(i, sy); j <= max(i, sy); j++) {
      if (a[sx][j] == '*') {
        ok1 = 0;
      }
    }
    for (long long j = min(sx, fx); j <= max(sx, fx); j++) {
      if (a[j][i] == '*') {
        ok2 = 0;
      }
    }
    for (long long j = min(i, fy); j <= max(i, fy); j++) {
      if (a[fx][j] == '*') {
        ok3 = 0;
      }
    }
    if (ok1 && ok2 && ok3) {
      cout << "YES";
      return 0;
    }
  }
  for (long long i = 1; i <= n; i++) {
    bool ok1 = 1, ok2 = 1, ok3 = 1;
    for (long long j = min(i, sx); j <= max(i, sx); j++) {
      if (a[j][sy] == '*') {
        ok1 = 0;
      }
    }
    for (long long j = min(sy, fy); j <= max(sy, fy); j++) {
      if (a[i][j] == '*') {
        ok2 = 0;
      }
    }
    for (long long j = min(i, fx); j <= max(i, fx); j++) {
      if (a[j][fy] == '*') {
        ok3 = 0;
      }
    }
    if (ok1 && ok2 && ok3) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
