#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
const int MAXN = 205;
char g[MAXN][MAXN];
int med[MAXN][MAXN];
int best[MAXN][MAXN];
int dr[4] = {-1, 1, 0, 0}, dc[4] = {0, 0, -1, 1};
int main(){
int h, w;
scanf("%d%d", &h, &w);
int sr = 0, sc = 0, tr = 0, tc = 0;
for(int i = 0; i < h; i++){
scanf("%s", g[i]);
for(int j = 0; j < w; j++){
if(g[i][j] == 'S'){ sr = i; sc = j; }
if(g[i][j] == 'T'){ tr = i; tc = j; }
}
}
int n;
scanf("%d", &n);
for(int i = 1; i <= h; i++) for(int j = 1; j <= w; j++) med[i][j] = -1;
for(int i = 0; i < n; i++){
int r, c, e;
scanf("%d%d%d", &r, &c, &e);
r--; c--;
if(med[r][c] < e) med[r][c] = e;
}
for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) best[i][j] = -1;
// 优先队列:能量大优先
priority_queue<pair<int, pair<int,int>>> pq;
best[sr][sc] = max(0, med[sr][sc]);
pq.push({best[sr][sc], {sr, sc}});
while(!pq.empty()){
auto top = pq.top(); pq.pop();
int e = top.first;
auto [r, c] = top.second;
if(e != best[r][c]) continue;
if(e == 0) continue; // 无能量不能移动
for(int k = 0; k < 4; k++){
int nr = r + dr[k], nc = c + dc[k];
if(nr < 0 || nr >= h || nc < 0 || nc >= w) continue;
if(g[nr][nc] == '#') continue;
int ne = e - 1;
if(med[nr][nc] > ne) ne = med[nr][nc];
if(ne > best[nr][nc]){
best[nr][nc] = ne;
pq.push({ne, {nr, nc}});
}
}
}
printf("%s\n", best[tr][tc] >= 0 ? "Yes" : "No");
return 0;
}