#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 1005;
using ll = long long;
using ld = long double;
char s[MAXN];
int ok[MAXN][MAXN];
int visited[MAXN][MAXN];
int psx[MAXN][MAXN];
int psy[MAXN][MAXN];
pair<int, int> start;
pair<int, int> end228;
bool null_x(int i, int l, int r) {
  if (l > r) swap(l, r);
  return (psx[r][i] - psx[l - 1][i]) == 0;
}
bool null_y(int i, int l, int r) {
  if (l > r) swap(l, r);
  return (psy[i][r] - psy[i][l - 1]) == 0;
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    for (int j = 1; j <= m; j++) {
      if (s[j - 1] == '*') {
        ok[i][j] = 1;
      } else if (s[j - 1] == 'S') {
        start = make_pair(i, j);
      } else if (s[j - 1] == 'T') {
        end228 = make_pair(i, j);
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      psy[i][j] = psy[i][j - 1] + ok[i][j];
    }
  }
  for (int j = 1; j <= m; j++) {
    for (int i = 1; i <= n; i++) {
      psx[i][j] = psx[i - 1][j] + ok[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    if (null_x(end228.second, end228.first, i) &&
        null_x(start.second, start.first, i) &&
        null_y(i, start.second, end228.second)) {
      puts("YES");
      return 0;
    }
  }
  for (int i = 1; i <= m; i++) {
    if (null_y(end228.first, i, end228.second) &&
        null_y(start.first, i, start.second) &&
        null_x(i, start.first, end228.first)) {
      puts("YES");
      return 0;
    }
  }
  puts("NO");
  return 0;
}
