#include #include #include using namespace std; int N, par, a, b, c, d, db, aa, bb; int apa[200000]; int hol(int x){ if(apa[x]<0) return (x); return (apa[x] = hol(apa[x])); } void unio(int x, int y){ x = hol(x); y = hol(y); if(x==y) return; if(apa[x],int> > szet[52]; void rak(int x, int f){ aa = a; bb = b; auto it = szet[x].lower_bound({{a-1,-1},-1}); it--; if((*it).first.second,int> p = (*szet[x].lower_bound({{aa,-1},-1})); while(p.first.first<=bb){ szet[x].erase(p); p = (*szet[x].lower_bound({{aa,-1},-1})); } szet[x].insert({{aa,bb},db}); } int main(){ ios_base::sync_with_stdio(false); cin >> N; for(int i=0; i> par >> c >> a >> d >> b; if(par){ swap(c,a); swap(b,d); swap(b,c); auto it = szet[a].lower_bound({{b,-1},-1}); it--; if((*it).first.second