Problem: Problem

Gaccho is enthusiastic about the popular game Zombie Hunter. In this game, there are 5 types of armor dedicated to the head, torso, arms, hips, and legs, and the player character (PC) operated by Gaccho can have up to 1 armor for each part of the body. Can be equipped.
In addition, the weight and defense power are set for each armor, and when the total weight of the armor equipped on the PC is A or more and B or less, and the total defense power is also A or more and B or less. The PC can activate the skill.

Gaccho has N pieces of armor. Find out if your PC can activate your skills by choosing the right armor to equip.

Constraints

The input satisfies the following conditions.

* 1 ≤ N ≤ 500
* 1 ≤ A ≤ B ≤ 1012
* 1 ≤ ti ≤ 5
* −1012 ≤ xi, yi ≤ 1012

Input

The input is given in the following format.


N A B
t1 x1 y1
t2 x2 y2
...
tN xN yN


All inputs are given as integers.
The first line gives you the number of armor N you own and the two integers A and B used to activate the skill.
Information on N pieces of armor is given to the N lines that continue from the second line. ti, xi, yi represent the type, weight, and defense of the i-th armor, respectively.

Armor type The ti value indicates that 1 is head armor, 2 is torso armor, 3 is arm armor, 4 is waist armor, and 5 is foot armor.

Output

Output "Yes" if the skill can be activated, and "No" if it cannot be activated on one line.

Examples

Input

7 10 11
1 1 0
1 0 1
2 2 2
3 3 5
4 1 3
5 1 3
5 5 -1


Output

Yes


Input

7 10 10
1 1 0
1 0 1
2 2 2
3 3 5
4 1 3
5 1 3
5 5 -1


Output

No

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int N,A,B;

vpint latte[5];


pint operator+(const pint &a,const pint &b){
    return {a.fi+b.fi,a.se+b.se};
}

signed main(){
    cin>>N>>A>>B;
    rep(i,N){
        int t,a,b;
        cin>>t>>a>>b;
        t--;
        latte[t].pb({a,b});
    }

    rep(i,5)latte[i].pb({0,0});

    vpint luz,izr;
    for(auto &a:latte[0])for(auto &b:latte[1])for(auto &c:latte[2])luz.pb(a+b+c);
    for(auto &d:latte[3])for(auto &e:latte[4])izr.pb(d+e);
    sort(all(luz));
    sort(all(izr));
    multiset<int>st;
    st.insert(1001001001001001001ll);

    int l=luz.size(),r=luz.size();
    for(auto &w:izr){
        while(l>0&&luz[l-1].fi+w.fi>=A){
            st.insert(luz[l-1].se);
            l--;
        }
        while(r>0&&luz[r-1].fi+w.fi>B){
            auto it=st.find(luz[r-1].se);
            st.erase(it);
            r--;
        }

        auto it=st.lower_bound(A-w.se);
        if(*it+w.se<=B){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}