#include using namespace std; struct city { int la,lo,h,p; }; bool compareHeight(city c1, city c2) { return (c1.h < c2.h); } int main(){ int n,x,y,i,j; long long int sum1=0,sum2=0,max; cin >> n >> x >> y; city * c = new city[n]; for(i= 0; i < n; i++) { cin >> c[i].la >> c[i].lo >> c[i].h >> c[i].p; } sort(c,c+n,compareHeight); sum1=sum2=max=c[0].p; for(i=0;i=sum2) max=sum1; else max=sum2; } printf("%lld",max); return 0; }