/* Creation Date - 30-01-2023 */  
/* Creation Time - 22:11:00.00 */  
#define ill 
/*
Written By : mafailure
In the name of God 
O Allah, May you grant peace and honor on Muhammad and his family.
Allahumm-a-Sall-iAla Muhammad-in Wa Al-i Muhammad
*/

#ifdef LOCAL 
#define AATIF_DEBUG
#endif 
/*Add -DLOCAL in 
compiler command 
to trigger it*/
  
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less
using namespace std;
using namespace __gnu_pbds;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
#define endl "\n"
/*------------------------int to long long -----------------*/
#ifdef ill
#define int long long 
#endif
/*---------------------------DEBUG HELPER--------------------------------------*/
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T,typename K> ostream& operator<<(ostream & os,const map<T,K> & mapp){ os<<"{"; string sep=""; for(const auto& x:mapp)os<<sep<<x,sep=", "; return os<<'}'; }
template <typename T> ostream & operator<<(ostream & os,const set<T> & sett){os<<'{'; string sep=""; for(const auto & x:sett)os<<sep<<x,sep=", "; return os<<'}';}
 
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
 
#ifdef AATIF_DEBUG
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif
 
//#define int long long 
// int dx[]={-1,1,0,0}; int dy[]={0,0,1,-1};
// int dx[]={2,2,-2,-2,1,1,-1,-1}; int dy[]={1,-1,1,-1,2,-2,2,-2};
#ifndef mod_2 
long long mod = 1e9 + 7;
#else 
long long mod =998244353; 
#endif 
const double eps=1e-9;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> ii;
typedef vector< pair< int, int > > vii;
typedef map<int, int> mii;
typedef pair<int, ii> pip;
typedef pair<ii, int> ppi;
#define arrinp(arr,init,final,size,type) type* arr=new type[size];for(int i=init;i<final;i++)cin>>arr[i];
#define cr2d(arr,n,m,t) t**arr=new t*[n];for(int i=0;i<n;i++)arr[i]=new t[m];
#define w(t) int t;cin>>t; while(t--)
#define takeInp(n) int n;cin>>n;
#define fr(i,init,final) for(int i=init;i<final;i++)
#define frr(i,init,final) for(int i=init;i>=final;i--)
#define Fr(i,final) for(int i=0;i<final;i++)
#define Frr(i,first) for(int i=first;i>=0;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define debug(x) cerr<<">value ("<<#x<<") : "<<x<<endl;
#define setb __builtin_popcount
#define lsone(n) (n&(-n))
#define rlsone(n) (n&(n-1))
#define clr(a,b) memset(a,b,sizeof(a))
#ifdef ill 
const int inf =1e18; 
#else 
const int inf=1e9;
#endif
/*-----------------------------RANDOM NUMBER GENERATOR ---------------------*/
#ifdef RNG 
unsigned seed=chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(seed);
#endif 
/*------------------------------UNORDERED MAP HASH --------------------------------------------*/
//To make unordered_map unhackable 
// use it as unordered_map<int,int,custom_hash> mapp;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        /* http://x...content-available-to-author-only...i.it/splitmix64.c */
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
/*---------------------------ORDERED SET--------------------------------------*/
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>  ordered_set; 
/*----------------------------------------------------------------------------*/
vi init(string s)
{
	istringstream sin(s);
	int n;
	vi arr;
	while(sin>>n)arr.push_back(n);
	return arr;
}
int power(int x, int y,int mod)
{ 
	if(y==0)return 1;
	int u=power(x,y/2,mod);
	u=(u*u)%mod;
	if(y%2)u=(x*u)%mod;
	return u;
    
}
int gcd(int a,int b)
{
	if(a<b)return gcd(b,a);
	return (b==0?a:(a%b?gcd(b,a%b):b));
}
int gcd_e(int a,int b,int &x,int &y)
{
	
	if(b==0){x=1; y=0; return a;}
	int x1,y1;
	int p=gcd_e(b,a%b,x1,y1);
	x=y1;
	y=x1-(a/b)*y1;
	return p;
}
/*-----------------to solve int to long long problem-----------------*/
int Min (int a,int b){return min(a,b);}
int Max(int a,int b){ return max(a,b);}
inline int add(int a,int b,int mod=mod){return (a+b)%mod;} 
inline int sub(int a,int b,int mod=mod){return (a-b+mod)%mod;}
inline int mul(int a,int b,int mod=mod){return (a*b%mod);}
//inline int divide(int a,int b,int mod=mod){return a*power(b,mod-2)%mod;}
inline int high(int a,int b){return (a>>b)&1;}
//786 121 786 121 786 121 786 121 786 121 786 121 786 121 786 121 786 121
/*========================CODE*****CODE****CODE======================*/

template<const int X=2> 
class StringHashing
{
	using T=array<int,X> ; 
	public: 
	function<T(int,int)> get_sub; 
	function<bool(int,int,int,int)> match_two_sub; 
	vector<T> hash,pp,ipp; 
	T p,ip,mod; 
	StringHashing(int N)
	{
		/*TODO Base values of mod, p, ip needs to be updated if you are using different X*/
		mod={(int)1e9+7,(int)1e8+7}; 
		p={37,43}; 
		ip={power(p[0],mod[0]-2,mod[0]),power(p[1],mod[1]-2,mod[1])}; 
		T base_val; 
		base_val.fill(1); 
	    pp=vector<T>(N,base_val); 
	    ipp=vector<T>(N,base_val); 
		for(int i=1;i<N;i++)
		{
			for(int j=0;j<X;j++)
			{
				pp[i][j]=mul(pp[i-1][j],p[j],mod[j]); 
				ipp[i][j]=mul(ipp[i-1][j],ip[j],mod[j]); 
			}
		}
	}
	
	
};
#include<bits/stdc++.h>
using namespace std; 
template<class T=int> 
struct FenwickTree:vector<T>
{
	public: 
	//inline int lsone(int i){return (i&(-i));}
	template<typename... Args> 
	FenwickTree(Args... args):vector<T>(args...){;}
	void update(int ind,T val,function<T(const T, const T)> f)
	{
		vector<T> & ft= *this; 
		for(int i=ind;i<ft.size();i+=lsone(i))ft[i]=f(ft[i],val); 
	}
	T query(int ind, T ans, function<T(const T,const T)> f)
	{
		vector<T> & ft = *this; 
		for(int i=ind;i;i-=lsone(i))ans=f(ft[i],ans); 
		return ans; 
	}
	T query_max(int ind ,int ans)
	{
	 	return query(ind,ans,[](T a,T b)->T{return a>b?a:b;}); 
	}
	T query_min(int ind,int ans)
	{
		return query(ind, ans,[](T a,T b)->T{return a<b?a:b;}); 
	}
	T query_cnt(int ind,int ans,int mod)
	{
		return query(ind, ans, [&](T a, T b)->T{return add(a,b,mod);}); 
	}
	void update_max(int ind,int val)
	{
		update(ind,val,[](T a,T b){return a>b?a:b;}); 
	}
	void update_min(int ind,int val)
	{
		update(ind,val,[](T a,T b){return a<b?a:b;}); 
	}
	void update_cnt(int ind,int val,int mod)
	{
		update(ind,val,[&](T a,T b){return add(a,b,mod);}); 
	}
	
	
	
};

signed main()
{
	IOS
	using T=array<int,2>; 
	int n,m; 
	cin>>n>>m; 
	int swapped=0;
	if(n>m)swapped=1,swap(n,m);
	vector<vector<FenwickTree<int>>> ft(n,vector<FenwickTree<int>>(2,FenwickTree<int>(m+1)));
	int q; 
	cin>>q; 
	vector<array<int,6>> store(q); 
	map<int,int> mapp;  
	for(int i=0;i<q;i++)
	{
		cin>>store[i][0]; 
		if(store[i][0]==1)fr(j,1,6)cin>>store[i][j]; 
		else fr(j,1,5)cin>>store[i][j];
		if(store[i][0]==1)mapp[store[i][5]]++; 
		 
	}
	int id=1; 
	for(auto & it:mapp)it.se=id++;
	StringHashing<2> helper(id+5);
	vector<T> hash(id+5); 
	fr(i,0,id+5)hash[i]=helper.pp[i]; 
	for(int i=0;i<q;i++)
	{
		if(store[i][0]==1)
		{
			int xa,ya,xb,yb; 
			xa=store[i][1],ya=store[i][2];
			xb=store[i][3],yb=store[i][4]; 
			if(swapped)swap(xa,ya),swap(xb,yb); 
			int c=mapp[store[i][5]]; 
			fr(x,xa-1,xb)
			{
				fr(j,0,2)
				ft[x][j].update_cnt(ya,hash[c][j],helper.mod[j]),
				ft[x][j].update_cnt(yb+1,sub(0,hash[c][j],helper.mod[j]),helper.mod[j]); 
			}
		}
		else 
		{
			int xa,ya,xb,yb; 
			xa=store[i][1],ya=store[i][2];
			xb=store[i][3],yb=store[i][4];
			if(swapped)swap(xa,ya),swap(xb,yb); 
			bool ok=1;
			fr(j,0,2)
			{
				if(ft[xa-1][j].query_cnt(ya,0,helper.mod[j])!=ft[xb-1][j].query_cnt(yb,0,helper.mod[j]))ok=0;	
			}
			cout<<(ok?"YES":"NO")<<endl; 
		}
	}
	
		
	
	 
	
	 
	
		 
}



