#include <bits/stdc++.h>
using namespace std;
char a[1010][1010];
int main() {
  long long n, m, k, left;
  while (cin >> n >> m) {
    long long index1, index2, startx, starty, index3, index4;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      for (long long j = 0; j < m; j++) {
        if (a[i][j] == 'S') {
          index1 = i;
          index2 = j;
        }
        if (a[i][j] == 'T') {
          index3 = i;
          index4 = j;
        }
      }
    }
    for (long long j = index2 - 1; j >= 0; j--) {
      if (a[index1][j] == '.') {
        a[index1][j] = '0';
      } else {
        break;
      }
    }
    for (long long j = index2 + 1; j < m; j++) {
      if (a[index1][j] == '.') {
        a[index1][j] = '0';
      } else {
        break;
      }
    }
    for (long long i = index1 - 1; i >= 0; i--) {
      if (a[i][index2] == '.') {
        a[i][index2] = '0';
      } else {
        break;
      }
    }
    for (long long i = index1 + 1; i < n; i++) {
      if (a[i][index2] == '.') {
        a[i][index2] = '0';
      } else {
        break;
      }
    }
    startx = index1;
    starty = index2;
    for (long long k1 = 0; k1 < n; k1++) {
      if (a[k1][starty] == '0') {
        index1 = k1;
        index2 = starty;
        for (long long j = index2 - 1; j >= 0; j--) {
          if (a[index1][j] == '.') {
            a[index1][j] = '1';
          } else if (a[index1][j] == '*') {
            break;
          }
        }
        for (long long j = index2 + 1; j < m; j++) {
          if (a[index1][j] == '.') {
            a[index1][j] = '1';
          } else if (a[index1][j] == '*') {
            break;
          }
        }
        for (long long i = index1 - 1; i >= 0; i--) {
          if (a[i][index2] == '.') {
            a[i][index2] = '1';
          } else if (a[i][index2] == '*') {
            break;
          }
        }
        for (long long i = index1 + 1; i < n; i++) {
          if (a[i][index2] == '.') {
            a[i][index2] = '1';
          } else if (a[i][index2] == '*') {
            break;
          }
        }
      }
    }
    for (long long k1 = 0; k1 < m; k1++) {
      if (a[startx][k1] == '0') {
        index1 = startx;
        index2 = k1;
        for (long long j = index2 - 1; j >= 0; j--) {
          if (a[index1][j] == '.') {
            a[index1][j] = '1';
          } else if (a[index1][j] == '*') {
            break;
          }
        }
        for (long long j = index2 + 1; j < m; j++) {
          if (a[index1][j] == '.') {
            a[index1][j] = '1';
          } else if (a[index1][j] == '*') {
            break;
          }
        }
        for (long long i = index1 - 1; i >= 0; i--) {
          if (a[i][index2] == '.') {
            a[i][index2] = '1';
          } else if (a[i][index2] == '*') {
            break;
          }
        }
        for (long long i = index1 + 1; i < n; i++) {
          if (a[i][index2] == '.') {
            a[i][index2] = '1';
          } else if (a[i][index2] == '*') {
            break;
          }
        }
      }
    }
    long long flag = 0;
    for (long long j = index4 - 1; j >= 0; j--) {
      if (a[index3][j] == '0' || a[index3][j] == '1' || a[index3][j] == 'S') {
        flag = 1;
      } else if (a[index3][j] == '*') {
        break;
      }
    }
    for (long long j = index4 + 1; j < m; j++) {
      if (a[index3][j] == '0' || a[index3][j] == '1' || a[index3][j] == 'S') {
        flag = 1;
      } else if (a[index3][j] == '*') {
        break;
      }
    }
    for (long long i = index3 - 1; i >= 0; i--) {
      if (a[i][index4] == '0' || a[i][index4] == '1' || a[i][index4] == 'S') {
        flag = 1;
      } else if (a[i][index4] == '*') {
        break;
      }
    }
    for (long long i = index3 + 1; i < n; i++) {
      if (a[i][index4] == '0' || a[i][index4] == '1' || a[i][index4] == 'S') {
        flag = 1;
      } else if (a[i][index4] == '*') {
        break;
      }
    }
    if (flag) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
