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;
 
typedef long long int64;
 
map< int64, int > data;
 
int64 sum(int64 k)
{
  k += 1e13;
  int ret = 0;
  for(; k > 0; k -= k & -k) {
    if(!data.count(k)) continue;
    ret += data[k];
  }
  return (ret);
}
 
void push(int64 k, int x)
{
  k += 1e13;
  for(; k < 1e14; k += k & -k) data[k] += x;
}
 
int main()
{
  int64 N, A, B;
  vector< pair< int64, int64 > > T[5];
 
  cin >> N >> A >> B;
  for(int i = 0; i < N; i++) {
    int64 a, b, c;
    cin >> a >> b >> c;
    T[--a].emplace_back(b, c);
  }
 
  for(int i = 0; i < 5; i++) {
    T[i].emplace_back(0LL, 0LL);
  }
 
  map< int64, vector< pair< int64, int > > > add;
  map< int64, vector< int64 > > que;
  map< int64, vector< pair< int64, int > > > del;
 
  for(auto &s : T[0]) {
    for(auto &t : T[1]) {
      for(auto &q : T[2]) {
        int64 a = s.first + t.first + q.first;
        int64 b = s.second + t.second + q.second;
        que[a].emplace_back(b);
      }
    }
  }
 
  for(auto &s : T[3]) {
    for(auto &t : T[4]) {
      int64 a = s.first + t.first;
      int64 b = s.second + t.second;
      pair< int64, int64 > latte = {A - a, B - a};
      pair< int64, int64 > malta = {A - b, B - b};
      if(latte.first > latte.second) continue;
      if(malta.first > malta.second) continue;
      add[latte.first].emplace_back(malta.first, +1);
      add[latte.first].emplace_back(malta.second + 1, -1);
      del[latte.second].emplace_back(malta.first, -1);
      del[latte.second].emplace_back(malta.second + 1, +1);
    }
  }
 
  auto ptr = que.begin();
  auto latte = add.begin(), malta = del.begin();
 
 
  while(ptr != que.end()) {
    while(latte != add.end() && latte->first <= ptr->first) {
      for(auto &v : latte->second) {
        push(v.first, v.second);
      }
      ++latte;
    }
    while(malta != del.end() && malta->first < ptr->first) {
      for(auto &v : malta->second) push(v.first, v.second);
      ++malta;
    }
    for(auto &v : ptr->second) {
      if(sum(v) != 0) {
        cout << "Yes" << endl;
        return (0);
      }
    }
    while(malta != del.end() && malta->first <= ptr->first) {
      for(auto &v : malta->second) push(v.first, v.second);
      ++malta;
    }
    ++ptr;
  }
 
  cout << "No" << endl;
}