#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const long long LINF = INF * (long long)INF;
const int MAX = 1010;
string A[MAX];
bool okS[MAX][MAX];
bool okF[MAX][MAX];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int n, m;
bool ok(int x, int y) {
  return x >= 0 && x < n && y >= 0 && y < m && A[x][y] != '*';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = (0); i < (n); i++) {
    cin >> A[i];
  }
  int sx, sy, fx, fy;
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (m); j++) {
      if (A[i][j] == 'S') sx = i, sy = j;
      if (A[i][j] == 'T') fx = i, fy = j;
    }
  for (int k = (0); k < (4); k++) {
    int x = sx;
    int y = sy;
    while (ok(x, y)) {
      okS[x][y] = true;
      x += dx[k];
      y += dy[k];
    }
    x = fx;
    y = fy;
    while (ok(x, y)) {
      okF[x][y] = true;
      x += dx[k];
      y += dy[k];
    }
  }
  for (int i = (0); i < (n); i++) {
    int maskOk = 0;
    for (int j = (0); j < (m); j++) {
      if (A[i][j] == '*') maskOk = 0;
      if (okS[i][j]) maskOk |= 1;
      if (okF[i][j]) maskOk |= 2;
      if (maskOk == 3) {
        cout << "YES";
        return 0;
      }
    }
  }
  for (int j = (0); j < (m); j++) {
    int maskOk = 0;
    for (int i = (0); i < (n); i++) {
      if (A[i][j] == '*') maskOk = 0;
      if (okS[i][j]) maskOk |= 1;
      if (okF[i][j]) maskOk |= 2;
      if (maskOk == 3) {
        cout << "YES";
        return 0;
      }
    }
  }
  cout << "NO";
}
