#include <bits/stdc++.h>
using namespace std;
map<unsigned long long, long long> mp;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
int n, m;
long long s[2510][2510];
inline int lowbit(int x) { return x & -x; }
inline void change(int x, int y, long long k) {
  for (int i = x; i <= n; i += lowbit(i)) {
    for (int j = y; j <= m; j += lowbit(j)) s[i][j] ^= k;
  }
}
inline long long getsum(int x, int y) {
  long long sum = 0;
  for (int i = x; i >= 1; i -= lowbit(i)) {
    for (int j = y; j >= 1; j -= lowbit(j)) sum ^= s[i][j];
  }
  return sum;
}
int main() {
  srand(time(0));
  n = read(), m = read();
  int q = read();
  for (int i = 1; i <= q; i++) {
    int id = read(), stx = read(), sty = read(), edx = read(), edy = read();
    if (id == 1 || id == 2) {
      unsigned long long p = stx;
      p = p * 13331 + sty;
      p = p * 13331 + edx;
      p = p * 13331 + edy;
      long long d;
      if (id == 1) {
        d = 1LL * (rand() + 1) * (rand() + 1) * (rand() + 1) * (rand() + 1);
        mp[p] = d;
      } else
        d = mp[p];
      change(stx, sty, d), change(stx, edy + 1, d), change(edx + 1, sty, d),
          change(edx + 1, edy + 1, d);
    } else {
      if (getsum(stx, sty) == getsum(edx, edy))
        printf("Yes\n");
      else
        printf("No\n");
    }
  }
  return 0;
}
