#include <bits/stdc++.h>
using namespace std;
constexpr auto PI = 3.14159265358979323846L;
constexpr auto oo = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
int x1, y11, x2, y2;
int r, c;
bool visl[1001][1001][3] = {false};
bool visr[1001][1001][3] = {false};
bool vist[1001][1001][3] = {false};
bool visb[1001][1001][3] = {false};
char m[1001][1001];
bool pos = false;
void dfsu(char d, int l, int x, int y) {
  if (l >= 3) return;
  if (x < 0 || x >= r) return;
  if (y < 0 || y >= c) return;
  if (d == 'L')
    if (visl[x][y][l])
      return;
    else
      visl[x][y][l] = true;
  if (d == 'R')
    if (visr[x][y][l])
      return;
    else
      visr[x][y][l] = true;
  if (d == 'T')
    if (vist[x][y][l])
      return;
    else
      vist[x][y][l] = true;
  if (d == 'B')
    if (visb[x][y][l])
      return;
    else
      visb[x][y][l] = true;
  if (m[x][y] == '*') return;
  if (m[x][y] == 'T') {
    pos = true;
    return;
  }
  if (d == 'L')
    dfsu('L', l, x, y - 1);
  else if (d != 'R')
    dfsu('L', l + 1, x, y - 1);
  if (d == 'R')
    dfsu('R', l, x, y + 1);
  else if (d != 'L')
    dfsu('R', l + 1, x, y + 1);
  if (d == 'T')
    dfsu('T', l, x - 1, y);
  else if (d != 'B')
    dfsu('T', l + 1, x - 1, y);
  if (d == 'B')
    dfsu('B', l, x + 1, y);
  else if (d != 'T')
    dfsu('B', l + 1, x + 1, y);
}
void dfs() {
  for (int i = 0; i < 3; i++) {
    visl[x1][y11][i] = true;
    visr[x1][y11][i] = true;
    visb[x1][y11][i] = true;
    vist[x1][y11][i] = true;
  }
  dfsu('T', 0, x1 - 1, y11);
  dfsu('B', 0, x1 + 1, y11);
  dfsu('L', 0, x1, y11 - 1);
  dfsu('R', 0, x1, y11 + 1);
}
int main() {
  cin >> r >> c;
  char t;
  for (int i = 0; i < r; i++)
    for (int j = 0; j < c; j++) {
      cin >> t, m[i][j] = t;
      if (t == 'S') x1 = i, y11 = j;
      if (t == 'T') x2 = i, y2 = j;
    }
  dfs();
  if (pos)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
