from collections import deque move = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]] h,w,sy,sx = list(map(int,input().split())) a = [list(input()) for i in range(h)] s = [[[[0,0] for i in range(8)] for u in range(w)] for j in range(h)] sy,sx = sy-1,sx-1 d = deque([(sy,sx,0,-1)]) while len(d): y,x,z,c = d.popleft() for i in range(8): Y,X = move[i] if 0 <= y+Y < h and 0 <= x+X < w and a[y+Y][x+X] == '.' and s[y+Y][x+X][i][z^1] == 0: s[y+Y][x+X][i][z^1] = s[y][x][c][z]+1 d.append((y+Y,x+X,z^1,i)) if 0 <= y+Y < h and 0 <= x+X < w and a[y+Y][x+X] == '.' and s[y+Y][x+X][i][z] == 0 and c == i: s[y+Y][x+X][c][z] = s[y][x][c][z] d.append((y+Y,x+X,z,i)) q = int(input()) for _ in range(q): y,x,t = list(map(int,input().split())) y,x = y-1,x-1 ans = "No" for i in range(8): if 0 < s[y][x][i][t%2] <= t: ans = "Yes" break print(ans)