#include <bits/stdc++.h>
using namespace std;
int s[1010][1010];
bool judge(int x1, int y1, int x2, int y2) {
  if (x1 == x2) {
    if (y1 > y2) swap(y1, y2);
    for (int i = y1; i <= y2; i++) {
      if (s[x1][i] == '*') {
        return false;
      }
    }
  } else if (y1 == y2) {
    if (x1 > x2) swap(x1, x2);
    for (int i = x1; i <= x2; i++) {
      if (s[i][y1] == '*') {
        return false;
      }
    }
  }
  return true;
}
int main() {
  int n, m;
  int sx, sy, tx, ty;
  scanf("%d%d", &n, &m);
  getchar();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%c", &s[i][j]);
      if (s[i][j] == 'S') {
        sx = i;
        sy = j;
      } else if (s[i][j] == 'T') {
        tx = i;
        ty = j;
      }
    }
    getchar();
  }
  int p, q;
  p = min(sx, tx);
  q = max(sx, tx);
  for (int i = 1; i <= m; i++) {
    bool flag1 = true;
    for (int j = p; j <= q; j++) {
      if (s[j][i] == '*') {
        flag1 = false;
        break;
      }
    }
    if (flag1 == true && judge(sx, sy, sx, i) && judge(tx, ty, tx, i)) {
      printf("YES\n");
      return 0;
    }
  }
  p = min(sy, ty);
  q = max(sy, ty);
  for (int i = 1; i <= n; i++) {
    bool flag1 = true;
    for (int j = p; j <= q; j++) {
      if (s[i][j] == '*') {
        flag1 = false;
        break;
      }
    }
    if (flag1 == true && judge(sx, sy, i, sy) && judge(tx, ty, i, ty)) {
      printf("YES\n");
      return 0;
    }
  }
  printf("NO\n");
  return 0;
}
