#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1e9 + 7;
long long int INF = 1e18;
long long int sub(long long int a, long long int b, long long int p = MOD) {
  return ((a % p) - (b % p) + p) % p;
}
long long int mult(long long int a, long long int b, long long int p = MOD) {
  return ((a % p) * (b % p)) % p;
}
long long int add(long long int a, long long int b, long long int p = MOD) {
  return (a % p + b % p) % p;
}
long long int fpow(long long int n, long long int k, long long int p = MOD) {
  long long int r = 1;
  while (k > 0) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
    k = k >> 1;
  }
  return r;
}
long long int inv(long long int a, long long int p = MOD) {
  return fpow(a, p - 2, p);
}
long long int fdiv(long long int a, long long int b, long long int p = MOD) {
  long long int yinv = inv(b);
  long long int ans = (a * yinv) % p;
  return ans;
}
unsigned long long int I1018 = 1000000000000000000;
const unsigned long long int I10e5 = 100000;
const long long int I10e6 = 1e6;
void printVecpll(std::vector<pair<long long int, long long int>> v) {
  for (auto p : v) {
    cout << p.first << " " << p.second << endl;
  }
}
template <typename T>
istream &operator>>(istream &in, vector<T> &a) {
  for (auto &item : a) {
    in >> item;
  }
  return in;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> &a) {
  for (auto &item : a) {
    out << item << " ";
  }
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, vector<vector<T>> &a) {
  for (auto &item : a) {
    out << item << "\n";
  }
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, set<T> &a) {
  for (auto &item : a) {
    out << item << " ";
  }
  return out;
}
std::vector<bool> is_prime;
std::vector<long long int> primes;
void sieve(long long int n) {
  is_prime.resize(n + 2, true);
  primes.clear();
  long long int p;
  for (p = 2; p * p <= n; p++) {
    if (is_prime[p]) {
      long long int i;
      for (i = p * p; i <= n; i += p) {
        is_prime[i] = false;
      }
    }
  }
  is_prime[0] = is_prime[1] = false;
  long long int i;
  for (i = 2; i <= n; i++) {
    if (is_prime[i]) {
      primes.emplace_back(i);
    }
  }
}
set<long long int> prime_factor(long long int n) {
  sieve(n);
  long long int i;
  set<long long int> s;
  for (auto p : primes) {
    if (p > sqrt(n)) break;
    while (n % p == 0 && n > 1) {
      s.insert(p);
      n /= p;
    }
  }
  if (n > 1) {
    s.insert(n);
  }
  return s;
}
long long int fl1[1200][1200], fl2[1200][1200];
long long int n, m;
char v[1200][1200];
void reach(long long int x, long long int y, long long int fl[1200][1200]) {
  long long int i;
  for (i = 0; x + i < n; i++) {
    if (v[x + i][y] == '*') break;
    fl[x + i][y] = 1;
  }
  for (i = 0; y + i < m; i++) {
    if (v[x][y + i] == '*') break;
    fl[x][y + i] = 1;
  }
  for (i = 0; x - i >= 0; i++) {
    if (v[x - i][y] == '*') break;
    fl[x - i][y] = 1;
  }
  for (i = 0; y - i >= 0; i++) {
    if (v[x][y - i] == '*') break;
    fl[x][y - i] = 1;
  }
}
bool ch(long long int x, long long int y) {
  long long int i;
  for (i = 0; x + i < n; i++) {
    if (v[x + i][y] == '*') break;
    if (fl2[x + i][y]) return true;
  }
  for (i = 0; y + i < m; i++) {
    if (v[x][y + i] == '*') break;
    if (fl2[x][y + 1]) return true;
  }
  for (i = 0; x - i >= 0; i++) {
    if (v[x - i][y] == '*') break;
    if (fl2[x - i][y]) return true;
  }
  for (i = 0; y - i >= 0; i++) {
    if (v[x][y - i] == '*') break;
    if (fl2[x][y - i]) return true;
  }
  return false;
}
int main() {
  long long int i, j, k;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  pair<long long int, long long int> start, end;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> v[i][j];
      if (v[i][j] == 'S') {
        start = make_pair(i, j);
      }
      if (v[i][j] == 'T') {
        end = make_pair(i, j);
      }
    }
  }
  reach(start.first, start.second, fl1);
  reach(end.first, end.second, fl2);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (fl1[i][j]) {
        if (ch(i, j)) {
          cout << "YES" << endl;
          return 0;
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
