#include <bits/stdc++.h>
template <typename T>
inline bool MIN(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool MAX(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
inline int plu(int a, int b) {
  return a + b >= 1000000007 ? a + b - 1000000007 : a + b;
}
inline int sub(int a, int b) { return a - b < 0 ? a - b + 1000000007 : a - b; }
inline int mul(int a, int b) { return (long long)a * b % 1000000007; }
inline int inc(int &a, int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
inline int dec(int &a, int b) {
  a -= b;
  if (a < 0) a += 1000000007;
}
using namespace std;
int n, m, Q;
int A[2510][2510];
int D[100010];
int find(int a, int b) {
  for (int i = a; i > 1; --i) {
    if (A[b][i] && D[A[b][i]] > a) {
      return A[b][i];
    }
  }
  return 0;
}
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  int id = 0;
  while (Q--) {
    ++id;
    int a, b, c, d, op;
    scanf("%d%d%d%d%d", &op, &a, &b, &c, &d);
    if (op == 1) {
      for (int i = b; i <= d; ++i) A[i][a] = id;
      D[id] = c + 1;
    }
    if (op == 2) {
      for (int i = b; i <= d; ++i) A[i][a] = 0;
    }
    if (op == 3) {
      if (find(a, b) == find(c, d))
        printf("Yes\n");
      else
        printf("No\n");
    }
  }
  return 0;
}
