#include <bits/stdc++.h>
using namespace std;
struct fenwickTree {
  int upd(int x, int y, long long val) {
    for (; x; x -= lsb(x))
      for (int j = y; j; j -= lsb(j)) f[x][j] ^= val;
  }
  long long qry(int x, int y) {
    long long sol = 0;
    for (; x <= n; x += lsb(x))
      for (int j = y; j <= m; j += lsb(j)) sol ^= f[x][j];
    return sol;
  }
  int lsb(int& x) { return x & (-x); }
  long long n, m, f[(int)(3e3 + 4)][(int)(3e3 + 4)];
};
int n, m, q, qryId[(int)(3e3 + 4)][(int)(3e3 + 4)];
long long hashval[(int)(1e5 + 4)];
fenwickTree bit;
int main() {
  mt19937_64 rng(time(NULL));
  cin >> n >> m >> q;
  bit.n = n;
  bit.m = m;
  for (int task, r1, c1, r2, c2; q; --q) {
    cin >> task >> r1 >> c1 >> r2 >> c2;
    if (task == 1) {
      hashval[q] = rng();
      qryId[r1][c1] = q;
      bit.upd(r2, c2, hashval[q]);
      bit.upd(r1 - 1, c2, hashval[q]);
      bit.upd(r2, c1 - 1, hashval[q]);
      bit.upd(r1 - 1, c1 - 1, hashval[q]);
    } else if (task == 2) {
      bit.upd(r2, c2, hashval[qryId[r1][c1]]);
      bit.upd(r1 - 1, c2, hashval[qryId[r1][c1]]);
      bit.upd(r2, c1 - 1, hashval[qryId[r1][c1]]);
      bit.upd(r1 - 1, c1 - 1, hashval[qryId[r1][c1]]);
    } else {
      long long hash1, hash2;
      hash1 = bit.qry(r1, c1);
      hash2 = bit.qry(r2, c2);
      cout << (hash1 == hash2 ? "Yes\n" : "No\n");
    }
  }
  return 0;
}
