异或和
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
new HDU5465().solve();
}
}
class HDU5465 {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
Bit bit = new Bit() ;
void solve() {
int t = in.nextInt() ;
while(t-- > 0){
int n = in.nextInt() ;
int m = in.nextInt() ;
bit.resize(n, m) ;
int q = in.nextInt() ;
for(int i = 1 ; i <= n ; i++){
for(int j = 1 ; j <= m ; j++)
bit.add(i, j, in.nextInt()) ;
}
while(q-- > 0){
if(in.nextInt() == 1){
if(bit.query(in.nextInt(), in.nextInt(), in.nextInt(), in.nextInt()) != 0)
out.println("Yes") ;
else out.println("No") ;
}
else bit.update(in.nextInt() , in.nextInt() , in.nextInt()) ;
}
}
out.flush() ;
}
}
class Bit{
final int N = 508 ;
int[][] val = new int[N][N] ;
int n , m ;
void resize(int n , int m){
this.n = n ;
this.m = m ;
for(int i = 1 ; i <= n ; i++)
for(int j = 1 ; j <= m ; j++) val[i][j] = 0 ;
}
int lowbit(int x){
return x & (-x) ;
}
void add(int i , int j , int c){
for(int x = i ; x <= n ; x += lowbit(x))
for(int y = j ; y <= m ; y += lowbit(y)) val[x][y] ^= c ;
}
int sum(int i , int j){
int res = 0 ;
for(int x = i ; x > 0 ; x -= lowbit(x))
for(int y = j ; y > 0 ; y -= lowbit(y)) res ^= val[x][y] ;
return res ;
}
int query(int x1 , int y1 , int x2 , int y2){
return sum(x2, y2) ^ sum(x2, y1-1) ^ sum(x1-1, y2) ^ sum(x1-1, y1-1) ;
}
void update(int x , int y , int c){
add(x, y, query(x, y, x, y)) ;
add(x, y, c) ;
}
}
class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = new StringTokenizer("") ;
}
private void eat(String s){
tokenizer = new StringTokenizer(s) ;
}
public String nextLine(){
try {
return reader.readLine() ;
} catch (Exception e) {
return null ;
}
}
public boolean hasNext(){
while(!tokenizer.hasMoreTokens()){
String s = nextLine() ;
if(s == null) return false ;
eat(s) ;
}
return true ;
}
public String next() {
hasNext() ;
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
public BigInteger nextBigInteger() {
return new BigInteger(next());
}
}