27 lines
604 B
Python
27 lines
604 B
Python
import sys
|
|
|
|
barrier = {}
|
|
|
|
rows, columns, questions = [int(x) for x in input("").split()]
|
|
|
|
for row in range(rows):
|
|
line = sys.stdin.readline()
|
|
for (column, value) in enumerate(map(int, line.split(" "))):
|
|
barrier[value] = (row+1, column+1)
|
|
|
|
# print(barrier)
|
|
|
|
for i in range(questions):
|
|
k, minrow, mincol, maxrow, maxcol = (int(x) for x in sys.stdin.readline().split(" "))
|
|
|
|
if k not in barrier:
|
|
print("no")
|
|
continue
|
|
|
|
row, col = barrier[k]
|
|
|
|
if (minrow <= row <= maxrow) and (mincol <= col <= maxcol):
|
|
print("yes")
|
|
continue
|
|
|
|
print("no")
|