#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define MAX 1024 #define X first #define Y second #define LB(x) ((x) & -(x)) using namespace std; typedef long long i64; typedef pair Pii; int a[MAX][MAX], c[MAX][MAX], n, m; void update(int x, int y, int v) { for (int i = x; i <= n; i += LB(i)) { for (int j = y; j <= m; j += LB(j)) { c[i][j] ^= v; } } } int query(int x, int y) { int ret = 0; for (int i = x; i; i -= LB(i)) { for (int j = y; j; j -= LB(j)) { ret ^= c[i][j]; } } return ret; } int query(int x1, int y1, int x2, int y2) { if (x1 > x2) swap(x1, x2); if (y1 > y2) swap(y1, y2); return query(x2, y2) ^ query(x1 - 1, y2) ^ query(x2, y1 - 1) ^ query(x1 - 1, y1 - 1); } int main() { int t, q; scanf("%d", &t); while (t--) { scanf("%d%d%d", &n, &m, &q); memset(c, 0, sizeof(c)); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { scanf("%d", &a[i][j]); update(i, j, a[i][j]); } } while (q--) { int opt; scanf("%d", &opt); if (opt == 1) { int x1, y1, x2, y2; scanf("%d%d%d%d", &x1, &y1, &x2, &y2); printf("%s\n", query(x1, y1, x2, y2) ? "Yes" : "No"); } else { int x, y, v; scanf("%d%d%d", &x, &y, &v); update(x, y, v ^ a[x][y]); a[x][y] = v; } } } return 0; }