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 <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{
	Info(ll arg_weight,ll arg_value){
		weight = arg_weight;
		value = arg_value;
	}
	bool operator<(const struct Info &arg) const{
		return weight < arg.weight;
	}
	ll weight,value;
};

int N;
ll A,B;
vector<Info> V[5],G[2];

int main(){

	scanf("%d %lld %lld",&N,&A,&B);

	int type;
	ll x,y;

	for(int i = 0; i < 5; i++)V[i].push_back(Info(0,0)); //装備なし

	for(int loop = 0; loop < N; loop++){
		scanf("%d %lld %lld",&type,&x,&y);
		type--;
		V[type].push_back(Info(x,y));
	}

	for(int i = 0; i < V[0].size(); i++){
		for(int k = 0; k < V[1].size(); k++){
			G[0].push_back(Info(V[0][i].weight+V[1][k].weight,V[0][i].value+V[1][k].value));
		}
	}

	for(int a = 0; a < V[2].size(); a++){
		for(int b = 0; b < V[3].size(); b++){
			for(int c = 0; c < V[4].size(); c++){
				G[1].push_back(Info(V[2][a].weight+V[3][b].weight+V[4][c].weight,V[2][a].value+V[3][b].value+V[4][c].value));
			}
		}
	}

	sort(G[0].begin(),G[0].end());
	sort(G[1].begin(),G[1].end());

	int add_index = G[1].size()-1,del_index = G[1].size()-1;

	map<ll,int> count;
	set<ll> SET;

	for(int i = 0; i < G[0].size(); i++){

		while(add_index >= 0 && G[0][i].weight+G[1][add_index].weight >= A){
			SET.insert(G[1][add_index].value);
			count[G[1][add_index].value]++;
			add_index--;
		}

		while(del_index > add_index && G[0][i].weight+G[1][del_index].weight > B){
			count[G[1][del_index].value]--;
			if(count[G[1][del_index].value] == 0)SET.erase(G[1][del_index].value);
			del_index--;
		}

		if(SET.lower_bound(A-G[0][i].value) != SET.upper_bound(B-G[0][i].value)){
			printf("Yes\n");
			return 0;
		}
	}

	printf("No\n");

	return 0;
}