has just learned about 2d matrices! Unfortunately, he can never seem to implement them properly.
Can you show him how its done?
Input Specifications
The first line will contain two integers and the number of rows and the number of columns in the matrix.
The next lines will contain space separated integers , the value in the th row and th column of the matrix.
The next line will contain a single integer the number of queries.
The next lines will consist of three operations:
C i j v
, Change the value at the th row and th column of the matrix to a value .Q i j
, Query the value at the th row and th column of the matrix.M i j
, Query the largest value that has ever been located in the th row and th column of the matrix.
Output Specification
For each Q
operation, output the value at the th row and th column of the matrix.
For each M
operation, output the largest value that has ever been located in the th row and th column of the matrix (values from the creation of the matrix are included).
Sample Input 1
4 3
2 4 2
6 3 7
2 3 6
9 3 9
4
Q 3 2
Q 1 1
Q 4 1
Q 3 1
Sample Output 1
3
2
9
2
Sample Input 2
2 2
1 10
3 7
5
Q 1 2
Q 2 2
C 1 2 3
Q 1 2
M 1 2
Sample Output 2
10
7
3
10
Comments