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)] D0 = [[[inf]*9 for _ in range(w)] for _ in range(h)] D1 = [[[inf]*9 for _ in range(w)] for _ in range(h)] B = [(sy, sx, 8)] D0[sy][sx][8] = 0 dy = [1, 1, 1, 0, -1, -1, -1, 0] dx = [1, 0, -1, -1, -1, 0, 1, 1] c = 0 mx = 0 while A:= B: B = [] if c % 2 == 0: D = D0 D_ = D1 else: D = D1 D_ = D0 while A: mx += 1 y, x, d = A.pop() if D[y][x][d] < c: continue for nd in range(8): ny, nx = y, x for _ in range(2): ny, nx = ny+dy[nd], nx+dx[nd] if d == nd: if 0 <= ny < h and 0 <= nx < w and S[ny][nx] == ".": if c < D[ny][nx][nd]: D[ny][nx][nd] = c A.append((ny, nx, nd)) else: break else: if 0 <= ny < h and 0 <= nx < w and S[ny][nx] == ".": if c+1 < D_[ny][nx][nd]: D_[ny][nx][nd] = c+1 B.append((ny, nx, nd)) else: break c += 1 if mx == 1: for _ in range(int(input())): gy, gx, t = list(map(lambda x: int(x)-1, input().split())) print("Yes" if (gy, gx) == (sy, sx) else "No") else: for _ in range(int(input())): gy, gx, t = list(map(lambda x: int(x)-1, input().split())) t += 1 if t % 2: D = D1 else: D = D0 ma = min(D[gy][gx]) if ma <= t: print("Yes") else: print("No") main()