#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  char arr[n][m + 1];
  int S[2], T[2];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    for (int j = 0; j < m; j++)
      if (arr[i][j] == 'S')
        S[0] = i, S[1] = j;
      else if (arr[i][j] == 'T')
        T[0] = i, T[1] = j;
  }
  int r, le, re;
  r = T[0];
  int ans = 0;
  set<pair<int, int> > st;
  for (re = T[1]; re < m; re++)
    if (arr[r][re] == '*')
      break;
    else {
      st.insert(make_pair(r, re));
    }
  for (int le = T[1]; le >= 0; le--)
    if (arr[r][le] == '*')
      break;
    else {
      st.insert(make_pair(r, le));
    }
  r = T[1];
  for (re = T[0]; re < n; re++)
    if (arr[re][r] == '*')
      break;
    else {
      st.insert(make_pair(re, r));
    }
  for (int le = T[0]; le >= 0; le--)
    if (arr[le][r] == '*')
      break;
    else {
      st.insert(make_pair(le, r));
    }
  int x = S[0], y = S[1];
  for (set<pair<int, int> >::iterator it = st.begin(); it != st.end(); it++) {
    int x1 = it->first, y1 = it->second;
    int flag1 = 0, flag2 = 0;
    int mi = min(x, x1);
    int ma = max(x, x1);
    for (int i = mi; i <= ma; i++)
      if (arr[i][y] == '*') flag1 = 1;
    mi = min(y, y1);
    ma = max(y, y1);
    for (int i = mi; i <= ma; i++)
      if (arr[x1][i] == '*') flag1 = 1;
    mi = min(y, y1);
    ma = max(y, y1);
    for (int i = mi; i <= ma; i++)
      if (arr[x][i] == '*') flag2 = 1;
    mi = min(x, x1);
    ma = max(x, x1);
    for (int i = mi; i <= ma; i++)
      if (arr[i][y1] == '*') flag2 = 1;
    if (flag1 == 0 || flag2 == 0) ans = 1;
  }
  if (ans)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
