def main(): h, w, sy, sx = list(map(int, input().split())) sy, sx = sy-1, sx-1 inf = 1<<60 S = [input() for _ in range(h)] D = [[[inf]*8 for _ in range(w)] for _ in range(h)] D[sy][sx] = [1] * 8 B = [(sy, sx, i) for i in range(8)] dy = [1, 1, 1, 0, -1, -1, -1, 0] dx = [1, 0, -1, -1, -1, 0, 1, 1] c = 1 while A:= B: B = [] while A: y, x, d = A.pop() if D[y][x][d] < c: continue for nd in range(8): ny, nx = y+dy[nd], x+dx[nd] if d == nd: if 0 <= ny < h and 0 <= nx < w and c < D[ny][nx][nd] and S[ny][nx] == ".": D[ny][nx][nd] = c A.append((ny, nx, nd)) else: if 0 <= ny < h and 0 <= nx < w and c+1 < D[ny][nx][nd] and S[ny][nx] == ".": D[ny][nx][nd] = c+1 B.append((ny, nx, nd)) c += 1 e = sum([1 for yx in range(h*w) if min(D[yx//w][yx%w]) != inf]) f = 0 if e == 3: X = [] for y in range(h): for x in range(w): if min(D[y][x]) != inf and (sy, sx) != (y, x): X.append((y, x)) gy0, gx0 = X[0] gy1, gx1 = X[1] if gy0+gy1 == sy*2 and gx0+gx1 == sx*2: pass else: if abs(gy0-sy)+abs(gx0-sx) == 2 and abs(gy1-sy)+abs(gx1-sx) == 2: f = 1 if not f and e != 2: for _ in range(int(input())): gy, gx, t = list(map(lambda x: int(x)-1, input().split())) t += 1 ma = min(D[gy][gx]) if ma <= t: print("Yes") else: print("No") else: for _ in range(int(input())): gy, gx, t = list(map(lambda x: int(x)-1, input().split())) t += 1 if (sy, sx) == (gy, gx): print("Yes" if not t % 2 else "No") elif min(D[gy][gx]) != inf: print("Yes" if t % 2 else "No") main()