#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long LL; typedef pair PII; typedef vector VI; typedef vector VPII; typedef pair PLL; typedef pair PIL; typedef pair PLI; typedef double DB; typedef long double LD; #define pb push_back #define all(x) (x).begin(), (x).end() #define bit(x) (1 << (x)) #define bitl(x) (1LL << (x)) #define sqr(x) ((x) * (x)) #define sz(x) ((int)(x.size())) #define counti(x) (__builtin_popcount(x)) #define countl(x) (__builtin_popcountll(x)) #define rep(i, n) for (int (i) = 0; (i) < (int)(n); ++(i)) #define X first #define Y second template inline void chkmax(T& x, U y) { if (x < y) x = y; } template inline void chkmin(T& x, U y) { if (y < x) x = y; } int get() { char c; while (c = getchar(), (c < '0' || c > '9') && (c != '-')); bool flag = (c == '-'); if (flag) c = getchar(); int x = 0; while (c >= '0' && c <= '9') { x = x * 10 + c - 48; c = getchar(); } return flag ? -x : x; } void output(int x) { if (x < 0) { putchar('-'); x = -x; } int len = 0, data[20]; while (x) { data[len++] = x % 10; x /= 10; } if (!len) data[len++] = 0; while (len--) putchar(data[len] + 48); putchar('\n'); } #define MX 505 int n, m; int val[MX][MX]; int a[MX][MX]; void add(int x, int y, int v) { int yy; for (; x <= n; x += x & -x) { for (yy = y; yy <= m; yy += yy & -yy) { val[x][yy] ^= v; } } } int calc(int x, int y) { int ret = 0; for (; x; x -= x & -x) { for (int yy = y; yy; yy -= yy & -yy) { ret ^= val[x][yy]; } } return ret; } int calc(int x, int y, int xx, int yy) { return calc(xx, yy)^ calc(x - 1, y - 1) ^ calc(xx, y - 1) ^ calc(x - 1, yy); } int main() { int Tcase; for (scanf("%d", &Tcase); Tcase--;) { int Q; scanf("%d%d%d", &n, &m, &Q); memset(val, 0, sizeof val); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { //scanf("%d", a[i] + j); a[i][j] = get(); add(i, j, a[i][j]); } } while (Q--) { int type; type = get(); if (type == 1) { int x1, x2, y1, y2; x1 = get(), y1= get(), x2 = get(), y2 = get(); int res = calc(x1, y1, x2, y2); if (res) { puts("Yes"); } else { puts("No"); } } else { int x, y, d; x = get(), y = get(), d = get(); add(x, y, a[x][y] ^ d); a[x][y] = d; } } } return 0; }