题目描述
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef wants to order food from a food delivery app. He wishes to order once today, and buy three items costing $A_{1}, A_{2}$ and $A_{3}$ rupees, respectively. He'll also order once tomorrow, when he'll buy three items costing $B_{1}, B_{2}$ and $B_{3}$ rupees, respectively. There is an additional delivery charge of rupees $D$ for each order.
He notices that there is a coupon on sale, which costs rupees $C$. If he buys that coupon, the delivery charges on any day, on an order of rupees $150$ or more shall be waived (that is, the $D$ rupees will not be added, if the sum of the costs of the items is $≥ 150$).
Note that Chef is ordering the three items together on each day, so the delivery charge is charged only once each day. Also, note that it's only needed to buy the coupon once to avail the delivery fee waiver on both days.
Should Chef buy the coupon? Note that Chef shall buy the coupon only if it costs him strictly less than what it costs him without the coupon, in total.
------ Input: ------
The first line of the input contains a single integer $T$, denoting the number of test cases.
The first line of each test case contains two space-separated integers $D$ and $C$, denoting the delivery charge, and the price of the coupon, respectively.
The second line of each test case contains three space-separated integers $A_{1}, A_{2}$ and $A_{3}$, denoting the prices of the food items that Chef plans to order on Day $1$, respectively.
The third line of each test case contains three space-separated integers $B_{1}$, $B_{2}$ and $B_{3}$, denoting the prices of the food items that Chef plans to order on Day $2$, respectively.
------ Output: ------
For each test case, output YES if Chef should buy the coupon, and NO otherwise, in a separate line.
------ Constraints ------
$1 ≤ T ≤ 10^{4}$
$1 ≤ D,C ≤ 100$
$1 ≤ A_{1}, A_{2}, A_{3} ≤ 100$
$1 ≤ B_{1}, B_{2}, B_{3} ≤ 100$
----- Sample Input 1 ------
2
90 100
100 50 10
80 80 80
30 30
100 100 100
10 20 30
----- Sample Output 1 ------
YES
NO
----- explanation 1 ------
Testcase 1: On the first day, Chef plans on ordering three food items, costing a total of rupees $(100+50+10)=160$. On the second day, Chef plans on ordering three food items, costing a total of rupees $(80+80+80)=240$.
If Chef buys the coupon he shall save the delivery charge on both days, but the coupon shall cost him rupees $100$ extra. In total, it shall cost him $(160+240+100)=500$.
Without the coupon, Chef will have to pay the delivery charges for both days, which shall cost him a total of rupees $(160+240+90+90)=580$.
Thus, it's better for Chef to buy the coupon.
Testcase 2: On the first day, Chef plans on ordering three food items, costing a total of rupees $(100+100+100)=300$. On the second day, Chef plans on ordering three food items, costing a total of rupees $(10+20+30)=60$.
If Chef buys the coupon he shall save the delivery charge on only the first day, but the coupon shall cost him rupees $30$ extra. In total, it shall cost him $(300+60+30$ (coupon cost) $+30$ (delivery cost for second day)$)=420$.
Without the coupon, Chef will have to pay the delivery charges for both days, which shall cost him a total of rupees $(300+60+30$ (delivery cost for first day)$+30$ (delivery cost for second day)$)=420$.
Since it shall cost him the same amount in both the cases, Chef shall not buy the coupon.
----- Sample Input 2 ------
1
30 45
100 100 100
10 20 30
----- Sample Output 2 ------
NO
----- explanation 2 ------
Testcase 1: On the first day, Chef plans on ordering three food items, costing a total of rupees $(100+100+100)=300$. On the second day, Chef plans on ordering three food items, costing a total of rupees $(10+20+30)=60$.
If Chef buys the coupon he shall save the delivery charge on only the first day, but the coupon shall cost him rupees $45$ extra. In total, it shall cost him $(300+60+45$ (coupon cost) $+30$ (delivery cost for second day)$)=435$.
Without the coupon, Chef will have to pay the delivery charges for both days, which shall cost him a total of rupees $(300+60+30$ (delivery cost for first day)$+30$ (delivery cost for second day)$)=420$.
Since it shall cost him strictly more amount when he buys the coupon, Chef shall not buy the coupon.
输入格式
见题面
输出格式
见题面