{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] \u003d 0 (1 \u0026lt;\u003d i, j \u0026lt;\u003d N).\r\u003cbr\u003e\r\u003cbr\u003eWe can change the matrix in the following way. Given a rectangle whose upper-left corner is (x1, y1) and lower-right corner is (x2, y2), we change all the elements in the rectangle by using \"not\" operation (if it is a \u00270\u0027 then change it into \u00271\u0027 otherwise change it into \u00270\u0027). To maintain the information of the matrix, you are asked to write a program to receive and execute two kinds of instructions.\r\u003cbr\u003e\r\u003cbr\u003e1.\tC x1 y1 x2 y2 (1 \u0026lt;\u003d x1 \u0026lt;\u003d x2 \u0026lt;\u003d n, 1 \u0026lt;\u003d y1 \u0026lt;\u003d y2 \u0026lt;\u003d n) changes the matrix by using the rectangle whose upper-left corner is (x1, y1) and lower-right corner is (x2, y2).\r\u003cbr\u003e2.\tQ x y (1 \u0026lt;\u003d x, y \u0026lt;\u003d n) querys A[x, y].\r\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input is an integer X (X \u0026lt;\u003d 10) representing the number of test cases. The following X blocks each represents a test case.\r\u003cbr\u003e\r\u003cbr\u003eThe first line of each block contains two numbers N and T (2 \u0026lt;\u003d N \u0026lt;\u003d 1000, 1 \u0026lt;\u003d T \u0026lt;\u003d 50000) representing the size of the matrix and the number of the instructions. The following T lines each represents an instruction having the format \"Q x y\" or \"C x1 y1 x2 y2\", which has been described above.\r\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each querying output one line, which has an integer representing A[x, y].\r\u003cbr\u003e\r\u003cbr\u003eThere is a blank line between every two continuous test cases.\r\u003cbr\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n2 10\r\nC 2 1 2 2\r\nQ 2 2\r\nC 2 1 2 1\r\nQ 1 1\r\nC 1 1 2 1\r\nC 1 2 1 2\r\nC 1 1 2 2\r\nQ 1 1\r\nC 1 1 2 1\r\nQ 2 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n0\r\n0\r\n1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}