The first line contains N (1≤N≤300). Each of the next N lines contains one row of the matrix as N numbers. Rows are numbered from top to bottom and columns from left to right, both starting at 1. Every entry of the matrix is a natural number not greater than 10.
The next line contains Q (1≤Q≤100000). Each of the next Q lines contains one query given as x1, y1, x2, y2, where x is a row number and y is a column number. (1≤x1≤x2≤N, 1≤y1≤y2≤N)