#include<bits/stdc++.h>
#define ___V6Kgpy4cDdF7Ai 	
#define ___hkCffWKq  
#define ___8ygqL5yhxz3vJG "%lld%lld%lld"
#define ___zHA8O "No"
#define ___zP4cfn2Rk "Yes"
#define ___fgJTiJ0ALQC );
#define ___hIMeNYDnWo ,&n,&m,&q);
#define ___LLz3Y2mt ,&px[i],&py[i],&pz[i]);
#define ___HDk15KVq4PJGPZ 0;
#define ___8GKVZm8K else 
#define ___UkH0D f=1;
#define ___5QrIkzcO fa[i]=i;
#define ___QoTDT fa[x]=fnd(fa[x]);
#define ___KUl1yw2iA4Uob6 fa[x]=y;
#define ___MfM74eQWdkddEC fnd(long 
#define ___RyMCTncSOIV fz1(i,n){
#define ___5M5GyxcTo fz1(i,q){
#define ___YAolGkfAQTB930 if(fa[x]==x) 
#define ___ppPDqVOb if(fnd(i)==i){
#define ___8lQCTx if(fnd(px[i])==fnd(py[i])){
#define ___fT4b8LYYGm if(l==2&&f==1){
#define ___chPwViwdZRJxT if(pz[i]==0){
#define ___1GOGBQj if(pz[i]==1){
#define ___o6Q0uE3LD if(typ[i]){
#define ___C4kIKW2lwZ if(u<=m&&m<=v) 
#define ___dnpCzs41OsXhM if(x!=y){
#define ___awglbK313e9M0 int 
#define ___jQPj1NGQ l++;
#define ___m2BmH2plICKQUJ long 
#define ___BqMVQC main()
#define ___xGWT7kN2N0WiON n,m,q,i,j,fa[100005],typ[100005],px[100005],py[100005],pz[100005],u,v,f,l;
#define ___45Exu5gMlFY namespace 
#define ___cDW5Vfn1zTX8c puts(
#define ___WOkhQFn6MU px[i]++;
#define ___Ghvvb py[i]++;
#define ___KqxSwktfxv7xR return 
#define ___nA3fbkorA scanf(
#define ___dvRMI6 std;
#define ___95cd3jw typ[fnd(px[i])]=typ[fnd(py[i])]=1;
#define ___6esnv u++;
#define ___FBWcIaTInZwts u+=l-1+f;
#define ___0DazejMOTeXxW using 
#define ___9mNZnJlp1UIxSl v=l*(l-1)/2+u;
#define ___NZvYvTNR x)
#define ___Y7lk79a x;
#define ___wf9XqVeDsQLq x=fnd(px[i]),y=fnd(py[i]);
#define ___QDI9D {
#define ___CH9oG3CQ }
#include <iostream> 
#include <algorithm> 
#include<cmath> 
#include<cstring> 
#include<cstdio> 
#include<cstdlib> 
#include<vector> 
#include<iomanip> 
#include<ctime> 
#include<set> 
#include<map> 
#include<queue> 
#include<stack> 
#define sqr(x) ((x)*(x)) 
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++) 
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--) 
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++) 
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--) 
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++) 
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--) 
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++) 
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--) 
#define fzin fz1(i,n) 
#define fzim fz1(i,m) 
#define fzjn fz1(j,n) 
#define fzjm fz1(j,m) 
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++) 
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;} 
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;} 
#define dec(x,y) {x-=(y);if(x<0)x+=mod;} 
___0DazejMOTeXxW ___45Exu5gMlFY ___dvRMI6 ___m2BmH2plICKQUJ ___m2BmH2plICKQUJ ___xGWT7kN2N0WiON ___m2BmH2plICKQUJ ___m2BmH2plICKQUJ 
___MfM74eQWdkddEC ___m2BmH2plICKQUJ ___NZvYvTNR ___QDI9D ___V6Kgpy4cDdF7Ai ___YAolGkfAQTB930 ___KqxSwktfxv7xR ___Y7lk79a 
___V6Kgpy4cDdF7Ai ___KqxSwktfxv7xR ___QoTDT ___CH9oG3CQ ___awglbK313e9M0 ___BqMVQC ___QDI9D ___V6Kgpy4cDdF7Ai ___nA3fbkorA 
___8ygqL5y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