Census

This year, there have been many problems with population calculations, since in some cities, there are many emigrants, or the population growth is very high. Every year the ACM (for Association for Counting Members) conducts a census in each region. The country is divided into N ∧ 2 regions, consisting of an N × N grid of regions. Your task is to find the least, and the greatest population in some set of regions. Since in a single year there is no significant change in the populations, the ACM modifies the population counts by some number of inhabitants. Input In the first line you will find N (0 ≤ N ≤ 500), in following the N lines you will be given N numbers, wich represent, the initial population of city C[i, j]. In the following line is the number Q (Q ≤ 40000), followed by Q lines with queries: There are two possible queries: • ‘q x1 y1 x2 y2’ which represent the coordinates of the upper left and lower right of where you must calculate the maximum and minimum change in population. • ‘c x y v’ indicating a change of the population of city C[x,y] by value v. Output Foreachquery,‘qx1 y1 x2 y2’printinasinglelinethegreatestandleastamountofcurrentpopulation. Separated each output by a space. Notice: There is only a single test case. Sample Input 5 12345 09213 02341 01245 85314 4 q1123 c 2 3 10 q1155 q1222 Sample Output 90 10 0 92