#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M,Q; cin >> N >> M >> Q; int A[N],B[N]; for(int i=0; i> A[i] >> B[i]; int n2 = 1< M+Q) continue; for(int k=(i-1)&i; k>0; k=(k-1)&i){ int left = i-k; if(left >= k) break; if(S[k] <= M) if(S[left] <= Q){answer = max(answer,S2[i]); break;} if(S[k] <= Q) if(S[left] <= M){answer = max(answer,S2[i]); break;} } } cout << answer << endl; }