#include <bits/stdc++.h>
using namespace std;
const int N = 2505;
struct node {
  node *lson, *rson;
  int xorsum;
} * t[N << 2];
int n, m, q, hs[N * N];
inline int calc(int x, int y) { return (x - 1) * m + y; }
node *newnode() {
  node *ret = new node;
  ret->lson = ret->rson = NULL;
  ret->xorsum = 0;
  return ret;
}
void ins2(node *&u, int l, int r, int ql, int qr, int x) {
  if (!u) u = newnode();
  if (l == ql && r == qr) {
    u->xorsum ^= x;
    return;
  }
  int mid = (l + r) / 2;
  if (qr <= mid)
    ins2(u->lson, l, mid, ql, qr, x);
  else if (ql > mid)
    ins2(u->rson, mid + 1, r, ql, qr, x);
  else {
    ins2(u->lson, l, mid, ql, mid, x);
    ins2(u->rson, mid + 1, r, mid + 1, qr, x);
  }
}
void ins(int u, int l, int r, int fl, int fr, int sl, int sr, int x) {
  if (l == fl && r == fr) {
    ins2(t[u], 1, m, sl, sr, x);
    return;
  }
  int mid = (l + r) / 2;
  if (fr <= mid)
    ins(u << 1, l, mid, fl, fr, sl, sr, x);
  else if (fl > mid)
    ins(u << 1 | 1, mid + 1, r, fl, fr, sl, sr, x);
  else {
    ins(u << 1, l, mid, fl, mid, sl, sr, x);
    ins(u << 1 | 1, mid + 1, r, mid + 1, fr, sl, sr, x);
  }
}
void ask2(node *u, int l, int r, int x, int &res) {
  if (!u) return;
  res ^= u->xorsum;
  if (l == r) return;
  int mid = (l + r) / 2;
  if (x <= mid)
    ask2(u->lson, l, mid, x, res);
  else
    ask2(u->rson, mid + 1, r, x, res);
}
void ask(int u, int l, int r, int fx, int sx, int &res) {
  ask2(t[u], 1, m, sx, res);
  if (l == r) return;
  int mid = (l + r) / 2;
  if (fx <= mid)
    ask(u << 1, l, mid, fx, sx, res);
  else
    ask(u << 1 | 1, mid + 1, r, fx, sx, res);
}
int main() {
  srand(time(0));
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= q; i++) {
    int ty, a, b, c, d;
    scanf("%d%d%d%d%d", &ty, &a, &b, &c, &d);
    if (ty == 1) {
      int rnd = (rand() << 7) ^ rand();
      ins(1, 1, n, a, c, b, d, rnd);
      hs[calc(a, b)] = rnd;
    } else if (ty == 2) {
      ins(1, 1, n, a, c, b, d, hs[calc(a, b)]);
    } else {
      int A = 0, B = 0;
      ask(1, 1, n, a, b, A);
      ask(1, 1, n, c, d, B);
      puts(A == B ? "Yes" : "No");
    }
  }
  return 0;
}
