#include #define int long long using namespace std; const int MAXN = 3e5+3; int compress(int x,int y){ return (x* (MAXN+2)) + y; } vector fau; vector siz; int find(int x){ if(fau[x] == x) return fau[x]; fau[x] = find(fau[x]); return fau[x]; } void unia(int x,int y){ x = find(x); y = find(y); if(x == y) return; if(siz[x] < siz[y]) swap(x,y); siz[x] += siz[y]; siz[y] = 0; fau[y] = x; } void join(int x,int y,int x2,int y2){ int a = compress(x,y); int b = compress(x2,y2); //cout<<"union "< > > prz; const int SIZ = (1<<20); int drzewo [54][2*SIZ]; void insertt(int x, int a, int b){ //cout<<"insert "< 0){ res += drzewo[x][a]; a/=2; } return res; } main(){ ios::sync_with_stdio(false); fau.resize(56*(MAXN+2)); siz.resize(56*(MAXN+2),1); for(int i=0;i> T; while(T--){ int ty,x,y,x2,y2; cin >> ty >> x >> y >> x2 >> y2; x++; y++; x2++; y2++; if(ty == 0){ if(x2 < x) swap(x2,x); if(y2 < y) swap(y2,y); } //cout< 0 && query(x2,y2) > 0 && find(compress(x,y)) == find(compress(x2,y2))) cout<<1<<"\n"; else cout<<"0\n"; //cout<first <= y2){ auto cur = *it; auto cp = it; it--; prz[i].erase(cp); // cout< 0) join(i,cur.first,i+1,cur.first); if(i+1 <= x2 || query(i+1,cur.second) > 0) join(i,cur.second,i+1,cur.second); if(i-1 >= x || query(i-1,cur.first) > 0){ //cout<<"okk"<= x || query(i-1,cur.second) > 0) join(i,cur.second,i-1,cur.second); if(cur.first-1 >= y || query(i,cur.first-1) > 0) join(i,cur.first,i,cur.first-1); if(cur.second+1 <= y2 || query(i,cur.second+1) > 0){ join(i,cur.second,i,cur.second+1); } it++; } //cout<first-1<first-1)); } } } }