#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> matrix(n);
  for (int i = 0; i < n; ++i) {
    cin >> matrix[i];
  }
  int si, sj, ti, tj;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (matrix[i][j] == 'S') {
        si = i;
        sj = j;
      }
      if (matrix[i][j] == 'T') {
        ti = i;
        tj = j;
      }
    }
  }
  vector<vector<int>> visited(n, vector<int>(m));
  visited[si][sj] = 1;
  for (int turn = 1; turn < 4; ++turn) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        if (visited[i][j] != turn) {
          continue;
        }
        for (int k = j - 1; k >= 0; --k) {
          if (visited[i][k] != 0 || matrix[i][k] == '*') {
            break;
          }
          visited[i][k] = turn + 1;
        }
        for (int k = j + 1; k < m; ++k) {
          if (visited[i][k] != 0 || matrix[i][k] == '*') {
            break;
          }
          visited[i][k] = turn + 1;
        }
        for (int k = i - 1; k >= 0; --k) {
          if (visited[k][j] != 0 || matrix[k][j] == '*') {
            break;
          }
          visited[k][j] = turn + 1;
        }
        for (int k = i + 1; k < n; ++k) {
          if (visited[k][j] != 0 || matrix[k][j] == '*') {
            break;
          }
          visited[k][j] = turn + 1;
        }
      }
    }
  }
  if (visited[ti][tj] <= 4 && visited[ti][tj] > 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
