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>
#define rep(i,n) for(int i=0;i<n;++i)
#define reps(i,o,n) for(int i=o;i<n;++i)
#define eb emplace_back
#define pb push_back
#define X first
#define Y second
#define all(X) X.begin(), X.end()

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main(){
  int n;
  ll a,b;
  cin>>n>>a>>b;
  vector<pll> vs[5];
  rep(i,n){
    ll t,x,y;
    cin>>t>>x>>y; --t;
    vs[t].eb(x,y);
  }
  sort(vs,vs+5,[](const vector<pll> &a,const vector<pll> &b){return a.size()<b.size();});
  map<ll,vector<ll>> ps{{0,{0}}},qs{{0,{0}}};
  
  rep(i,3) for(pll p:vs[i]) qs[p.X].pb(p.Y);
  for(pll p:vs[0])for(pll q:vs[1])for(pll r:vs[2]) qs[p.X+q.X+r.X].pb(p.Y+q.Y+r.Y);
  for(pll p:vs[0])for(pll q:vs[1]) qs[p.X+q.X].pb(p.Y+q.Y);
  for(pll p:vs[0])for(pll r:vs[2]) qs[p.X+r.X].pb(p.Y+r.Y);
  for(pll q:vs[1])for(pll r:vs[2]) qs[q.X+r.X].pb(q.Y+r.Y);
  for(auto &p:qs) sort(all(p.Y));
  
  reps(i,3,5) for(pll p:vs[i]) ps[p.X].pb(p.Y);
  for(pll p:vs[3])for(pll q:vs[4]) ps[p.X+q.X].pb(p.Y+q.Y);
  for(auto &p:ps) sort(all(p.Y));
  //rep(i,5){for(pll x:vs[i]) cout<<x.X<<","<<x.Y<<"  ";cout<<endl;}
  
  // for(auto p:ps){cout<<p.X<<":"; for(int y:p.Y) cout<<y<<",";cout<<endl;}
  // for(auto p:qs){cout<<p.X<<":"; for(int y:p.Y) cout<<y<<",";cout<<endl;}
  map<ll,ll> cnt;
  auto l=ps.rbegin(),r=l;
  for(auto &p:qs){
    for(;r!=ps.rend();++r){
      if(r->X < a-p.X) break;
      for(ll y:r->Y) ++cnt[y];
    }
    for(;l!=ps.rend();++l){
      if(l->X <= b-p.X) break;
      vector<ll> rm;
      for(ll y:l->Y) if(--cnt[y]==0) rm.pb(y);
      for(ll y:rm) cnt.erase(y);
    }
    // cout<<p.X<<endl;
    // for(pll x:cnt)cout<<x.X<<","<<x.Y<<"  ";cout<<endl;
    for(ll y:p.Y){
      auto it=cnt.lower_bound(a-y);
      if(it!=cnt.end() && it->X<=b-y){
	cout<<"Yes"<<endl;
	return 0;
      }
    }
  }
  cout<<"No"<<endl;
  return 0;
}