#include <bits/stdc++.h>
using namespace std;
int path[1005][1005], row[1005][1005], col[1005][1005];
int n, m, sourx, soury, destx, desty;
int main() {
  char c;
  fflush(stdin);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cin >> c;
      if (c == 'S') {
        sourx = i;
        soury = j;
      } else if (c == 'T') {
        destx = i;
        desty = j;
      } else if (c == '*') {
        path[i][j] = 1;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      row[i][j] = row[i][j - 1] + path[i][j];
      col[i][j] = col[i - 1][j] + path[i][j];
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (col[i][soury] != col[sourx][soury] || path[i][soury] == 1) continue;
    if (col[i][desty] != col[destx][desty] || path[i][desty] == 1) continue;
    if (row[i][soury] != row[i][desty]) continue;
    cout << "YES" << endl;
    return 0;
  }
  for (int i = 1; i <= m; ++i) {
    if (row[sourx][soury] != row[sourx][i] || path[sourx][i] == 1) continue;
    if (row[destx][desty] != row[destx][i] || path[destx][i] == 1) continue;
    if (col[sourx][i] != col[destx][i]) continue;
    cout << "YES" << endl;
    return 0;
  }
  cout << "NO" << endl;
  return 0;
}
