#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string str[n];
  for (int i = 0; i < n; i++) cin >> str[i];
  int dp[n][m];
  int x, y, a, b;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      dp[i][j] = 1000;
      if (str[i][j] == 'S') {
        x = i;
        y = j;
      }
      if (str[i][j] == 'T') {
        a = i;
        b = j;
      }
    }
  }
  for (int i = x; i >= 0; i--) {
    if (str[i][y] == '*') break;
    dp[i][y] = 0;
    int xx = i, yy = y;
    for (int j = yy; j >= 0; j--) {
      if (str[xx][j] == '*') break;
      dp[xx][j] = 0;
    }
    for (int j = yy; j < m; j++) {
      if (str[xx][j] == '*') break;
      dp[xx][j] = 0;
    }
  }
  for (int i = x; i < n; i++) {
    if (str[i][y] == '*') break;
    dp[i][y] = 0;
    int xx = i, yy = y;
    for (int j = yy; j >= 0; j--) {
      if (str[xx][j] == '*') break;
      dp[xx][j] = 0;
    }
    for (int j = yy; j < m; j++) {
      if (str[xx][j] == '*') break;
      dp[xx][j] = 0;
    }
  }
  for (int i = y; i >= 0; i--) {
    if (str[x][i] == '*') break;
    dp[x][i] = 0;
    int xx = x, yy = i;
    for (int j = xx; j >= 0; j--) {
      if (str[j][yy] == '*') break;
      dp[j][yy] = 0;
    }
    for (int j = xx; j < n; j++) {
      if (str[j][yy] == '*') break;
      dp[j][yy] = 0;
    }
  }
  for (int i = y; i < m; i++) {
    if (str[x][i] == '*') break;
    dp[x][i] = 0;
    int xx = x, yy = i;
    for (int j = xx; j >= 0; j--) {
      if (str[j][yy] == '*') break;
      dp[j][yy] = 0;
    }
    for (int j = xx; j < n; j++) {
      if (str[j][yy] == '*') break;
      dp[j][yy] = 0;
    }
  }
  bool ck = false;
  for (int i = a; i >= 0; i--) {
    if (str[i][b] == '*') break;
    if (dp[i][b] == 0) ck = true;
  }
  for (int i = a; i < n; i++) {
    if (str[i][b] == '*') break;
    if (dp[i][b] == 0) ck = true;
  }
  for (int i = b; i >= 0; i--) {
    if (str[a][i] == '*') break;
    if (dp[a][i] == 0) ck = true;
  }
  for (int i = b; i < m; i++) {
    if (str[a][i] == '*') break;
    if (dp[a][i] == 0) ck = true;
  }
  if (ck)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
