#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
using namespace std;
const int N = 1000 + 10;
int n, m;
char a[N][N];
int dirx[] = {-1, 0, 0, 1};
int diry[] = {0, 1, -1, 0};
void sol() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (n); ++i) scanf("%s", a[i]);
  int srow, scol, trow, tcol;
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (m); ++j) {
      if (a[i][j] == 'S') {
        srow = i;
        scol = j;
      }
      if (a[i][j] == 'T') {
        trow = i;
        tcol = j;
      }
    }
  for (int direct = 0; direct < (4); ++direct) {
    int r = trow;
    int c = tcol;
    r += dirx[direct];
    c += diry[direct];
    while (r < n && r >= 0 && c < m && c >= 0 && a[r][c] == '.') {
      a[r][c] = 'T';
      r += dirx[direct];
      c += diry[direct];
    }
    r = srow;
    c = scol;
    r += dirx[direct];
    c += diry[direct];
    while (r < n && r >= 0 && c < m && c >= 0 && a[r][c] == '.') {
      a[r][c] = 'S';
      r += dirx[direct];
      c += diry[direct];
    }
  }
  for (int i = 0; i < (n); ++i) {
    bool iss = false, ist = false;
    for (int j = 0; j < (m); ++j) {
      if (a[i][j] == 'S') iss = true;
      if (a[i][j] == 'T') ist = true;
      if (iss && ist) {
        printf("YES\n");
        return;
      }
      if (a[i][j] == '*') {
        iss = false;
        ist = false;
      }
    }
  }
  for (int j = 0; j < (m); ++j) {
    bool iss = false, ist = false;
    for (int i = 0; i < (n); ++i) {
      if (a[i][j] == 'S') iss = true;
      if (a[i][j] == 'T') ist = true;
      if (iss && ist) {
        printf("YES\n");
        return;
      }
      if (a[i][j] == '*') {
        iss = false;
        ist = false;
      }
    }
  }
  printf("NO\n");
}
void clear() {}
void once() {}
void solve() {
  int T;
  T = 1;
  once();
  for (int i = 1; i <= (int)(T); ++i) {
    clear();
    sol();
  }
}
void testgen() {
  FILE* f = fopen("input.txt", "w");
  int n = 2000, m = 1000000000;
  fprintf(f, "1\n", n);
  fprintf(f, "%d %d\n", n, m);
  srand(time(NULL));
  for (int i = 0; i < (n); ++i) fprintf(f, "%d\n", rand() % 2000);
  fclose(f);
}
int main() {
  cout << fixed;
  cout.precision(6);
  cerr << fixed;
  cerr.precision(3);
  solve();
  return 0;
}
