#include #include using namespace std; struct Cake{ int a,b,c; bool operator <(const Cake &t)const{ if (a != t.a) return a < t.a; return b > t.b; } }C[200200]; int N,V; long long B[200200]; void push(int x, long long u) { while (x <= V){ B[x] = max(B[x],u); x += x & (-x); } } long long pop(int x) { long long r = 0; while (x){ r = max(r,B[x]); x -= x & (-x); } return r; } int main() { scanf ("%d",&N); for (int i=0;i