#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define X first #define Y second #define pb push_back #define rep(X,Y) for (int (X) = 0;(X) < (int)(Y);++(X)) #define reps(X,S,Y) for (int (X) = (int)(S);(X) < (int)(Y);++(X)) #define rrep(X,Y) for (int (X) = (int)(Y)-1;(X) >=0;--(X)) #define rreps(X,S,Y) for (int (X) = (int)(Y)-1;(X) >= (int)(S);--(X)) #define repe(X,Y) for ((X) = 0;(X) < (Y);++(X)) #define peat(X,Y) for (;(X) < (Y);++(X)) #define all(X) (X).begin(),(X).end() #define rall(X) (X).rbegin(),(X).rend() #define eb emplace_back #define UNIQUE(X) (X).erase(unique(all(X)),(X).end()) #define Endl endl #define NL <<"\n" #define cauto const auto using namespace std; using ll=long long; using pii=pair; using pll=pair; template using vv=vector>; template inline bool MX(T &l,const T &r){return l inline bool MN(T &l,const T &r){return l>r?l=r,1:0;} //#undef NUIP #ifdef NUIP #include "benri.h" #else #define out(args...) #endif void ouT(ll x,int d=3){auto re=to_string(x);if((int)re.size()>d) re=x>0?"oo":"-oo";cout<vector table(int n, T v){ return vector(n, v);} template auto table(int n, Args... args){auto val = table(args...); return vector(n, move(val));} #endif template pair operator+(const pair &p,const pair &q){ return {p.X+q.X,p.Y+q.Y};} template pair& operator+=(pair &p,const pair &q){ p.X+=q.X; p.Y+=q.Y; return p;} template pair operator-(const pair &p,const pair &q){ return {p.X-q.X,p.Y-q.Y};} template pair& operator-=(pair &p,const pair &q){ p.X-=q.X; p.Y-=q.Y; return p;} template istream& operator>>(istream &is, pair &p){ is>>p.X>>p.Y; return is;} template T read(){ T re; cin>>re; return re;} template T read(const T &dec){ T re; cin>>re; return re-dec;} template vector readV(const int sz){ vector re(sz); for(auto &x:re) x=read(); return re;} template vector readV(const int sz, const T &dec){ vector re(sz); for(auto &x:re) x=read(dec); return re;} vv readG(const int &n,const int &m){ vv g(n); rep(_,m){ cauto a=read(1),b=read(1); g[a].pb(b); g[b].pb(a);} return g;} vv readG(const int &n){ return readG(n,n-1);} vv readD(const int &n,const int &m){ vv g(n); rep(_,m){ cauto a=read(1),b=read(1); g[a].pb(b); } return g;} vv readD(const int &n){ return readD(n,n-1);} template vv> readG(const int &n,const int &m){ vv> g(n); rep(_,m){ cauto a=read(1),b=read(1); cauto c=read(); g[a].eb(b,c); g[b].eb(a,c);} return g;} template vv> readG(const int &n){ return readG(n,n-1);} template vv> readD(const int &n,const int &m){ vv> g(n); rep(_,m){ cauto a=read(1),b=read(1); cauto c=read(); g[a].eb(b,c); } return g;} template vv> readD(const int &n){ return readD(n,n-1);} #ifdef __cpp_init_captures template vector readT(int n, T v){ return readV(n,v);} template auto readT(int n, Args... args){ vector re(1,readT(args...));rep(_,n-1) re.eb(readT(args...)); return re;} template void addadd(T& t1, const T& t2, integer_sequence){ cauto l = { (get(t1) += get(t2), 0)... }; (void)l;} template tuple& operator += (tuple& lhs, const tuple& rhs){ addadd(lhs, rhs, index_sequence_for{}); return lhs;} template tuple operator +(tuple lhs, const tuple& rhs){ return lhs += rhs;} template void subsub(T& t1, const T& t2, integer_sequence){ cauto l = { (get(t1) -= get(t2), 0)... }; (void)l;} template tuple& operator -= (tuple& lhs, const tuple& rhs){ subsub(lhs, rhs, index_sequence_for{}); return lhs;} template tuple operator - (tuple lhs, const tuple& rhs){ return lhs -= rhs;} template void read_tuple_impl(istream &is, Tuple& t, index_sequence){((is >> get(t)), ...);} template auto& operator>>(istream &is, tuple& t){ read_tuple_impl(is, t, index_sequence_for{}); return is;} #endif #define TT cauto TTT=read();rep(_,TTT) const ll MOD=1e9+7; //998244353; const int nn=412345; ll bit[nn+1]; ll maxf(int i){++i; //�Ķ�� ll s=-1; while(i>0){ s=max(s,bit[i]); i-=i&-i; }return s; } void upd(int i,ll val){++i; //��꾮�����Τ˹����������Τ� while(i<=nn){ bit[i]=max(bit[i],val); i+=i&-i; } return; } ll area(pii a,pii b){ return abs(1ll*a.X*b.Y-1ll*a.Y*b.X); } int main(){ fill(bit,bit+nn+1,-1); ios_base::sync_with_stdio(false); cin.tie(0); cout<> ints; rep(i,n){ cauto p=read(); cauto q=read(); cauto r=read(); ints.eb(min({p.X,q.X,r.X}), max({p.X,q.X,r.X}), area(p-r,q-r)); } vector> qs; rep(i,q){ if(read()==1){ cauto p=read(); cauto q=read(); cauto r=read(); qs.eb(min({p.X,q.X,r.X}), max({p.X,q.X,r.X}), area(p-r,q-r)); }else{ cauto l=read(0); cauto r=read(0); qs.eb(l,r,-1); } } int N; { vector xs; for(cauto &tp:ints){ xs.eb(get<0>(tp)); xs.eb(get<1>(tp)); } for(cauto &tp:qs){ xs.eb(get<0>(tp)); xs.eb(get<1>(tp)); } sort(all(xs)); UNIQUE(xs); N=xs.size(); for(auto &tp:ints){ get<0>(tp)=lower_bound(all(xs),get<0>(tp))-xs.begin(); get<1>(tp)=lower_bound(all(xs),get<1>(tp))-xs.begin(); } for(auto &tp:qs){ get<0>(tp)=lower_bound(all(xs),get<0>(tp))-xs.begin(); get<1>(tp)=lower_bound(all(xs),get<1>(tp))-xs.begin(); } } vector re(q,-1); vv ad(N),ask(N); rep(i,ints.size()) ad[get<0>(ints[i])].eb(i); rep(i,qs.size()) ask[get<0>(qs[i])].eb(i); rrep(i,N){ for(cauto &j:ad[i]) upd(get<1>(ints[j]),get<2>(ints[j])); // out(i,1); // rep(j,10) cout<(qs[j]))); } out(re,1); { vector> ints; rep(i,q){ cauto &[l,r,a]=qs[i]; if(a>=0){ ints.eb(l,r,a); }else{ for(cauto &[L,R,A]:ints)if(l<=L && R<=r) MX(re[i],A); } } } rep(i,q)if(get<2>(qs[i])<0) cout<