#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10, T = 3;
int n, m;
char grid[N][N];
int sx = -1, sy = -1;
int tx = -1, ty = -1;
bool solve() {
  int lsy, rsy;
  for (int j = sy; j < m; j++) {
    if (grid[sx][j] == 'T') return true;
    if (grid[sx][j] == '*') break;
    rsy = j;
  }
  for (int j = sy; j >= 0; j--) {
    if (grid[sx][j] == 'T') return true;
    if (grid[sx][j] == '*') break;
    lsy = j;
  }
  int lty, rty;
  for (int j = ty; j < m; j++) {
    if (grid[tx][j] == '*') break;
    rty = j;
  }
  for (int j = ty; j >= 0; j--) {
    if (grid[tx][j] == '*') break;
    lty = j;
  }
  int ly = max(lty, lsy), ry = min(rty, rsy);
  for (int j = ly; j <= ry; j++) {
    bool poss = true;
    for (int i = min(sx, tx); i <= max(sx, tx); i++) {
      if (grid[i][j] == '*') poss = false;
    }
    if (poss) return true;
  }
  int lsx, rsx;
  for (int i = sx; i < n; i++) {
    if (grid[i][sy] == 'T') return true;
    if (grid[i][sy] == '*') break;
    rsx = i;
  }
  for (int i = sx; i >= 0; i--) {
    if (grid[i][sy] == 'T') return true;
    if (grid[i][sy] == '*') break;
    lsx = i;
  }
  int ltx, rtx;
  for (int i = tx; i < n; i++) {
    if (grid[i][ty] == '*') break;
    rtx = i;
  }
  for (int i = tx; i >= 0; i--) {
    if (grid[i][ty] == '*') break;
    ltx = i;
  }
  int lx = max(ltx, lsx), rx = min(rtx, rsx);
  for (int i = lx; i <= rx; i++) {
    bool poss = true;
    for (int j = min(sy, ty); j <= max(sy, ty); j++) {
      if (grid[i][j] == '*') poss = false;
    }
    if (poss) return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> grid[i];
    for (int j = 0; j < m; j++) {
      if (grid[i][j] == 'S') sx = i, sy = j;
      if (grid[i][j] == 'T') tx = i, ty = j;
    }
  }
  cout << (solve() ? "YES" : "NO") << '\n';
  return 0;
}
