#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1010;   long long c[2][2][MAXN][MAXN] = {0};   int n, m;   long long val;   int lowbit(int x) { return x & -x; }   void add(int a, int b) {     for (int i = a; i <= n; i += lowbit(i))       for (int j = b; j <= n; j += lowbit(j)) c[a & 1][b & 1][i][j] ^= val;   }   long long sum(int a, int b) {     long long ans = 0;     for (int i = a; i >= 1; i -= lowbit(i))       for (int j = b; j >= 1; j -= lowbit(j)) ans ^= c[a & 1][b & 1][i][j];     return ans;   }   int main() {     scanf( %d%d , &n, &m);     int x1, x2, y1, y2, op;     long long ans;     for (int i = 1; i <= m; i++) {       scanf( %d , &op);       if (op == 1) {         scanf( %d%d%d%d , &x1, &y1, &x2, &y2);         ans =             sum(x2, y2) ^ sum(x2, y1 - 1) ^ sum(x1 - 1, y2) ^ sum(x1 - 1, y1 - 1);         printf( %I64d n , ans);       } else {         scanf( %d%d%d%d%I64d , &x1, &y1, &x2, &y2, &val);         add(x1, y1);         add(x2 + 1, y1);         add(x1, y2 + 1);         add(x2 + 1, y2 + 1);       }     }     return 0;   }   