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 X = [[-1 if min(D[y][x]) != inf else -2 for x in range(w)] for y in range(h)] S = [(sy, sx)] X[sy][sx] = 0 f = 1 c = 0 while S and f: c += 1 y, x = S.pop() for d in range(8): ny, nx = y, x f = 0 for _ in range(2): f ^= 1 ny, nx = ny+dy[d], nx+dx[d] if not (0 <= ny < h and 0 <= nx < w): break if X[ny][nx] == -2: break if X[ny][nx] == -1: X[ny][nx] = X[y][x]^1 S.append((ny, nx)) else: if X[ny][nx]^X[y][x]^1: f = 0 break else: f = 0 break if c == 1 and f: for _ in range(int(input())): gy, gx, t = list(map(lambda x: int(x)-1, input().split())) t += 1 if (gy, gx) == (sy, sx): print("Yes") else: print("No") elif not f: for _ in range(int(input())): gy, gx, t = list(map(lambda x: int(x)-1, input().split())) t += 1 if (sy, sx) == (gy, sx) and t == 1: print("No") else: 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") else: print("No") main()