#include <bits/stdc++.h>
using namespace std;
inline char nchar() {
  static const int bufl = 1 << 20;
  static char buf[bufl], *a, *b;
  return a == b && (b = (a = buf) + fread(buf, 1, bufl, stdin), a == b) ? EOF
                                                                        : *a++;
}
inline int read() {
  int x = 0, f = 1;
  char c = nchar();
  for (; !isdigit(c); c = nchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = nchar()) x = x * 10 + c - '0';
  return x * f;
}
const int maxn = 2502;
long long e[maxn][maxn];
int n, m, q;
inline int lowbit(int x) { return x & -x; }
void mod(int x, int y, long long d) {
  for (int i = x; i <= n; i += lowbit(i))
    for (int j = y; j <= m; j += lowbit(j)) e[i][j] ^= d;
}
long long get(int x, int y) {
  long long ret = 0;
  for (int i = x; i; i -= lowbit(i))
    for (int j = y; j; j -= lowbit(j)) ret ^= e[i][j];
  return ret;
}
map<pair<int, int>, long long> mp;
int main() {
  n = read(), m = read(), q = read();
  for (int i = 1; i <= q; ++i) {
    int o = read(), a = read(), b = read(), c = read(), d = read();
    if (o == 3)
      puts(get(a, b) == get(c, d) ? "Yes" : "No");
    else {
      long long &id = mp[pair<int, int>(a, b)];
      if (!id) id = (long long)rand() << 31 | rand();
      mod(a, b, id), mod(a, d + 1, id), mod(c + 1, b, id),
          mod(c + 1, d + 1, id);
    }
  }
  return 0;
}
