#include <bits/stdc++.h>
using namespace std;
template <class T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U>
void R(T &head, U &...tail) {
  _R(head);
  R(tail...);
}
template <class T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T, class U>
void _W(const pair<T, U> &x) {
  _W(x.first);
  putchar(' ');
  _W(x.second);
}
template <class T>
void _W(const vector<T> &x) {
  for (auto i = x.begin(); i != x.end(); _W(*i++))
    if (i != x.cbegin()) putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &...tail) {
  _W(head);
  putchar(sizeof...(tail) ? ' ' : '\n');
  W(tail...);
}
int MOD = 1e9 + 7;
void ADD(long long &x, long long v) {
  x = (x + v) % MOD;
  if (x < 0) x += MOD;
}
const int SIZE = 2010;
char s[SIZE][SIZE];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int n, m;
bool out(int x, int y) {
  return 0 > x || x >= n || 0 > y || y >= m || s[x][y] == '*';
}
void AC() {
  W("YES");
  exit(0);
}
int main() {
  R(n, m);
  pair<int, int> x, y;
  for (int i = 0; i < (n); ++i) {
    scanf("%s", (s[i]));
    for (int j = 0; j < (m); ++j) {
      if (s[i][j] == 'S')
        x = make_pair(i, j);
      else if (s[i][j] == 'T')
        y = make_pair(i, j);
    }
  }
  for (int i = 0; i < (4); ++i) {
    pair<int, int> now = x;
    while (!out(now.first, now.second)) {
      if (s[now.first][now.second] == 'T') AC();
      s[now.first][now.second] = 'S';
      now.first += dx[i];
      now.second += dy[i];
    }
  }
  for (int i = 0; i < (4); ++i) {
    pair<int, int> now = y;
    while (!out(now.first, now.second)) {
      if (s[now.first][now.second] == 'S') AC();
      s[now.first][now.second] = 'T';
      now.first += dx[i];
      now.second += dy[i];
    }
  }
  for (int i = 0; i < (n); ++i) {
    for (int j = 0, k; j < m; j = k) {
      if (s[i][j] == '*') {
        k = j + 1;
        continue;
      }
      int now = 0;
      for (k = j; k < m && s[i][k] != '*'; k++) {
        if (s[i][k] == 'S')
          now |= 1;
        else if (s[i][k] == 'T')
          now |= 2;
      }
      if (now == 3) AC();
    }
  }
  for (int j = 0; j < (m); ++j) {
    for (int i = 0, k; i < n; i = k) {
      if (s[i][j] == '*') {
        k = i + 1;
        continue;
      }
      int now = 0;
      for (k = i; k < n && s[k][j] != '*'; k++) {
        if (s[k][j] == 'S')
          now |= 1;
        else if (s[k][j] == 'T')
          now |= 2;
      }
      if (now == 3) AC();
    }
  }
  W("NO");
  return 0;
}
