It's winter and taking a bath is a delicate matter. Chef has two buckets of water. The first bucket has $v_1$ volume of cold water at temperature $t_1$. The second has $v_2$ volume of hot water at temperature $t_2$. Chef wants to take a bath with at least $v_3$ volume of water which is at exactly $t_3$ temperature. To get the required amount of water, Chef can mix some water obtained from the first and second buckets.
Mixing $v_x$ volume of water at temperature $t_x$ with $v_y$ volume of water at temperature $t_y$ yields $v_x + v_y$ volume of water at temperature calculated as
vxtx+vytyvx+vyvxtx+vytyvx+vy\frac{v_x t_x + v_y t_y}{v_x + v_y}
Help Chef figure out if it is possible for him to take a bath with at least $v_3$ volume of water at temperature $t_3$.
Assume that Chef has no other source of water and that no heat is lost by the water in the buckets with time, so Chef cannot simply wait for the water to cool.

-----Input-----
- The first line contains $n$, the number of test cases. $n$ cases follow.
- Each testcase contains of a single line containing 6 integers $v_1, t_1, v_2, t_2, v_3, t_3$.

-----Output-----
- For each test case, print a single line containing "YES" if Chef can take a bath the way he wants and "NO" otherwise.

-----Constraints-----
- $1 \leq n \leq 10^5$
- $1 \leq v_1, v_2, v_3 \leq 10^6$
- $1 \leq t_1 < t_2 \leq 10^6$
- $1 \leq t_3 \leq 10^6$

-----Sample Input-----
3
5 10 5 20 8 15
5 10 5 20 1 30
5 10 5 20 5 20

-----Sample Output-----
YES
NO
YES

-----Explanation-----
- Case 1: Mixing all the water in both buckets yields 10 volume of water at temperature 15, which is more than the required 8.
- Case 2: It is not possible to get water at 30 temperature.
- Case 3: Chef can take a bath using only the water in the second bucket.

Difficulty: MEDIUM_HARD
Tags: Matrices

Mathematics

Starter code:

Solutions:
for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	if t3 > t2 or t3 < t1:
		print('NO')
		continue
	x = v3 * ((t2 - t3) / (t2 - t1))
	y = v3 - x
	if x <= v1 and y <= v2:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	(v1, t1, v2, t2, v3, t3) = map(int, input().strip().split(' '))
	if t3 <= max(t1, t2) and t3 >= min(t1, t2):
		if v3 < v1 + v2:
			if t1 == t2 == t3:
				print('YES')
			elif t3 == t1 and t1 != t2:
				if v3 <= v1:
					print('YES')
				else:
					print('NO')
			elif t3 == t2 and t1 != t2:
				if v3 <= v2:
					print('YES')
				else:
					print('NO')
			elif t1 == t2 and t2 != t3:
				print('NO')
			elif v2 >= v3 * (t3 - t1) / (t2 - t1) and v1 >= v3 * (t2 - t3) / (t2 - t1):
				print('YES')
			else:
				print('NO')
		elif v3 == v1 + v2:
			if v3 * t3 == v1 * t1 + v2 * t2:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')
	t -= 1


for t in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split(' '))
	if v3 > v1 + v2:
		print('NO')
	elif t3 > t2:
		print('NO')
	elif t3 < t1:
		print('NO')
	elif t3 == t2:
		if v3 <= v2:
			print('YES')
		else:
			print('NO')
	elif t3 == t1:
		if v3 <= v1:
			print('YES')
		else:
			print('NO')
	elif (t3 - t1) * v3 / (t2 - t1) <= v2 and v3 - (t3 - t1) * v3 / (t2 - t1) <= v1:
		print('YES')
	else:
		print('NO')


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
y = 'YES'
n = 'NO'
t = int(input())
for tt in range(t):
	(v1, t1, v2, t2, v3, t3) = map(int, sys.stdin.readline().split(' '))
	if t1 == t2:
		if t1 == t3 and v1 + v2 >= v3:
			print(y)
			continue
		else:
			print(n)
			continue
	if t1 == t3:
		if v1 >= v3:
			print(y)
		else:
			print(n)
		continue
	if t2 == t3:
		if v2 >= v3:
			print(y)
		else:
			print(n)
		continue
	vy = v3 * (t1 - t3) / (t1 - t2)
	vx = vy * (t3 - t2) / (t1 - t3)
	if vx >= 0 and vy >= 0 and (vx <= v1) and (vy <= v2):
		print(y)
	else:
		print(n)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


t = int(input())
for i in range(t):
	(v1, t1, v2, t2, v3, t3) = map(int, input().strip().split())
	vx = t2 - t3
	vy = t3 - t1
	if t1 <= t3 <= t2:
		if vx * v3 <= (vx + vy) * v1 and vy * v3 <= (vx + vy) * v2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	if v1 + v2 < v3 or t3 < t1 or t3 > t2:
		print('NO')
		continue
	p = v3 * ((t3 - t1) / (t2 - t1))
	q = v3 * ((t2 - t3) / (t2 - t1))
	if 0 <= q <= v1 and 0 <= p <= v2:
		print('YES')
	else:
		print('NO')


import math
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = list(map(int, input().split()))
	if v1 >= v3 and t1 == t2 or (v2 >= v3 and t2 == t3):
		print('YES')
		continue
	else:
		vx = v3 * (t3 - t2) // (t1 - t2)
		vy = v3 * ((t1 - t3) / (t1 - t2))
		if 0 <= vx <= v1 and 0 <= vy <= v2:
			print('YES')
		else:
			print('NO')


t = int(input())
for i in range(t):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	x = v3 * (t3 - t2) / (t1 - t2)
	if 0 <= x <= v1 and 0 <= v3 - x <= v2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	vx = v3 * (t3 - t2) / (t1 - t2)
	vy = v3 * (t3 - t1) / (t2 - t1)
	if 0 <= vx <= v1 and 0 <= vy <= v2:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	V1 = (t3 - t2) / (t1 - t2) * v3
	V2 = v3 - V1
	if V1 >= 0 and V2 >= 0 and (V1 <= v1) and (V2 <= v2):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	ans = 'NO'
	if t3 >= t1 and t3 <= t2 and (v3 <= v1 + v2):
		T = (t3 - t1) / (t2 - t1)
		vy = v3 * T
		vx = v3 - vy
		if vx <= v1 and vy <= v2:
			ans = 'YES'
	print(ans)


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = [int(i) for i in input().split()]
	ans = 0
	if t1 > t2 and t1 >= t3 and (t3 >= t2) and (v1 * (t1 - t2) >= v3 * (t3 - t2) and v2 * (t1 - t2) >= v3 * (t1 - t3)):
		ans = 1
	if t1 <= t2 and t1 <= t3 and (t3 <= t2) and (v1 * (t2 - t1) >= v3 * (t2 - t3) and v2 * (t2 - t1) >= v3 * (t3 - t1)):
		ans = 1
	print(['NO', 'YES'][ans])


t = int(input())
while t > 0:
	t -= 1
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	if t3 >= t1 and t3 <= t2 and (v3 <= v1 + v2):
		vy = v3 * (t3 - t1) / (t2 - t1)
		vx = v3 - vy
		if vx <= v1 and vy <= v2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


import sys, math
import io, os
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
from fractions import Fraction
mod = int(1000000000.0) + 7
for i in range(int(data())):
	(v1, t1, v2, t2, v3, t3) = mdata()
	if v2 > v2 + v1:
		out('NO')
		continue
	if Fraction(min(v2, v3) * t2 + (v3 - min(v2, v3)) * t1, v3) >= t3 >= Fraction(min(v1, v3) * t1 + (v3 - min(v1, v3)) * t2, v3):
		out('YES')
	else:
		out('NO')


for n in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	ok = 0
	if t1 <= t3 <= t2:
		(x, y) = (t2 - t3, t3 - t1)
		ok = x * v3 <= (x + y) * v1 and y * v3 <= (x + y) * v2
	print('YES' if ok else 'NO')


try:
	for i in range(int(input())):
		(v1, t1, v2, t2, v3, t3) = map(int, input().split())
		ok = 0
		if t1 <= t3 <= t2:
			(x, y) = (t2 - t3, t3 - t1)
			ok = x * v3 <= (x + y) * v1 and y * v3 <= (x + y) * v2
		print('YES' if ok else 'NO')
except:
	pass


tc = int(input())
while tc != 0:
	tc -= 1
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	if t1 == t3 and t3 == t2:
		if v1 + v2 > v3:
			print('YES')
		else:
			print('NO')
	elif t1 == t2:
		if v1 >= v3:
			print('YES')
		else:
			print('NO')
		continue
	l = v3 * (t1 - t3) / (t1 - t2)
	r = (v1 + v2) * (t1 - t3) / (t1 - t2)
	l1 = v3 * (t3 - t2) / (t1 - t2)
	r1 = (v1 + v2) * (t3 - t2) / (t1 - t2)
	if l <= min(v2, r) and l1 <= min(v1, r1):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = list(map(int, input().split()))
	if t3 >= min(t1, t2) and t3 <= max(t1, t2) and (v3 <= v1 + v2):
		p = t2 - t3
		q = t3 - t1
		if p * v3 <= (p + q) * v1 and q * v3 <= (p + q) * v2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(v1, a, v2, b, v3, c) = map(int, input().split())
	if a == c or c == b:
		if c == b:
			if v3 <= v2:
				print('YES')
			else:
				print('NO')
		elif v3 <= v1:
			print('YES')
		else:
			print('NO')
		continue
	k = (c - a) / (b - c)
	x = v3 / (k + 1)
	y = k * x
	if x >= 0 and y >= 0 and (x <= v1) and (y <= v2) and (c <= max(a, b)) and (c >= min(a, b)) and (v3 <= v1 + v2):
		print('YES')
	else:
		print('NO')


test_cases = int(input())
for i in range(test_cases):
	(v1, t1, v2, t2, v3, t3) = list(map(int, input().split()))
	calc1 = v3 * (t1 - t3) / (t1 - t2)
	calc2 = v3 * (t3 - t2) / (t1 - t2)
	if calc1 >= 0 and calc2 >= 0:
		if v2 >= calc1 and v1 >= calc2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = list(map(int, input().split()))
	if v1 + v2 < v3 or t3 > max(t1, t2) or t3 < min(t1, t2):
		print('NO')
	else:
		num = t3 - t1
		den = t2 - t3
		if v2 * (t2 - t1) >= v3 * (t3 - t1) and v1 * (t2 - t1) >= v3 * (t2 - t3):
			print('YES')
		else:
			print('NO')


t = int(input())
win = 0
while t > 0:
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	if t1 != t2:
		x = (t3 * v3 - t2 * v3) / (t1 - t2)
		if x <= v1 and v3 - x <= v2 and (x >= 0) and (v3 - x >= 0):
			print('YES')
		else:
			print('NO')
	elif t1 == t3:
		print('YES')
	else:
		print('NO')
	t -= 1


for t in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	if t1 > t3 and t2 > t3 or (t1 < t3 and t2 < t3) or v1 + v2 < v3:
		print('NO')
		continue
	if t2 < t1:
		(t1, t2) = (t2, t1)
		(v1, v2) = (v2, v1)
	mint = 0
	maxt = 0
	if v1 >= v3:
		mint = t1
	else:
		mint = (t1 * v1 + t2 * (v3 - v1)) / v3
	if v2 >= v3:
		maxt = t2
	else:
		maxt = (t2 * v2 + t1 * (v3 - v2)) / v3
	if t3 <= maxt and t3 >= mint:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(v2, t2, v1, t1, v3, t3) = list(map(int, input().split()))
	rem = v3 - v1
	if rem < 0:
		maxi = t1
	else:
		maxi = (v1 * t1 + t2 * rem) / (v1 + rem)
	rem = v3 - v2
	if rem < 0:
		mini = t2
	else:
		mini = (v2 * t2 + t1 * rem) / (v2 + rem)
	if mini <= t3 <= maxi:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout

def inp():
	return int(stdin.readline())

def minp():
	return map(int, stdin.readline().rstrip().split())

def linp():
	return list(minp())

def main():
	for _ in range(inp()):
		(v1, t1, v2, t2, v3, t3) = minp()
		if v3 > v1 + v2:
			print('NO')
		else:
			x = v3 * (t3 - t1) / (t2 - t1)
			y = v3 * (t3 - t2) / (t1 - t2)
			if x <= v2 and y <= v1 and (x >= 0) and (y >= 0):
				print('YES')
			else:
				print('NO')
main()


def test():
	(v1, t1, v2, t2, v3, t3) = map(int, input().split(' '))
	req = v3 * t3
	if v1 + v2 < v3 or max(t1, t2) < t3:
		print('NO')
		return 0
	else:
		x = v3 * (t3 - t2) / (t1 - t2)
		y = v3 * (t3 - t1) / (t2 - t1)
		if x <= v1 and y <= v2 and (x >= 0) and (y >= 0):
			print('YES')
		else:
			print('NO')
	return 0
t = int(input())
for i in range(t):
	testy = test()


T = int(input())
for q in range(T):
	(v1, t1, v2, t2, v3, t3) = map(int, input().strip().split())
	if v1 + v2 < v3:
		print('NO')
	else:
		x = v3 * (t3 - t1) / (t2 - t1)
		y = v3 * (t3 - t2) / (t1 - t2)
		if x <= v2 and y <= v1 and (x >= 0) and (y >= 0):
			print('YES')
		else:
			print('NO')


from sys import stdin, stdout

def lin():
	return int(stdin.readline())

def mlin():
	return map(int, stdin.readline().rstrip().split())

def llin():
	return list(mlin())

def res():
	for i in range(lin()):
		(v1, t1, v2, t2, v3, t3) = mlin()
		if v1 + v2 < v3:
			print('NO')
		else:
			x = v3 * (t3 - t2) / (t1 - t2)
			y = v3 * (t3 - t1) / (t2 - t1)
			if x <= v1 and y <= v2 and (x >= 0) and (y >= 0):
				print('YES')
			else:
				print('NO')
res()


for i in range(int(input())):
	(a, b, c, d, e, f) = map(int, input().split(' '))
	counter = 0
	if b > d:
		(b, d) = (d, b)
		(a, c) = (c, a)
	if a + c < e or f > max(b, d) or f < min(b, d):
		print('NO')
	else:
		gg = d - b
		h = f - b
		k = d - f
		if k * e / gg <= a:
			counter = counter + 1
		if h * e / gg <= c:
			counter = counter + 1
		if counter is 2:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	if t1 != t3:
		ratio = (t3 - t2) / (t1 - t3)
	if t1 == t3:
		if v3 <= v1:
			print('YES')
		else:
			print('NO')
	if t2 == t3:
		if v3 <= v2:
			print('YES')
		else:
			print('NO')
	if t1 < t3 and t3 < t2:
		if v3 <= v1 + v2:
			if ratio >= 0:
				if v2 >= v3 / (ratio + 1) and v1 >= v3 * ratio / (1 + ratio):
					print('YES')
				else:
					print('NO')
		else:
			print('NO')
	if t3 < t1 or t2 < t3:
		print('NO')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	x = v3 * (t3 - t2)
	y = t1 - t2
	if y != 0:
		x = x / y
		if x >= 0 and v3 - x >= 0 and (x <= v1) and (v3 - x <= v2):
			print('YES')
		else:
			print('NO')
	elif t1 == t3:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
ans = list()
while t != 0:
	(v1, t1, v2, t2, v3, t3) = [int(num) for num in input().split()]
	if v3 > v1 + v2:
		ans.append(1)
	elif t1 == t2:
		if t1 == t3:
			ans.append(0)
		else:
			ans.append(1)
	else:
		check1 = 1 - t1 / t3
		check2 = 1 - t2 / t3
		if check1 * check2 > 0:
			ans.append(1)
		elif check1 == 0:
			if v1 < v3:
				ans.append(1)
			else:
				ans.append(0)
		elif check2 == 0:
			if v2 < v3:
				ans.append(1)
			else:
				ans.append(0)
		else:
			frac = -check2 / check1
			vol1 = round(v3 / (1 + frac), 3)
			vol2 = v3 - vol1
			if vol1 <= v2 and vol2 <= v1 and (v1 >= 0) and (v2 >= 0):
				ans.append(0)
			else:
				ans.append(1)
	t = t - 1
for x in ans:
	if x == 0:
		print('YES')
	elif x == 1:
		print('NO')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	if t3 < t1 or t3 > t2:
		print('NO')
	else:
		c1 = t3 - t1
		c2 = t2 - t1
		x = min(c2 - c1, c1)
		y = max(c2 - c1, c1)
		if t3 == t1:
			if v3 <= v1:
				print('YES')
			else:
				print('NO')
		elif t2 == t3:
			if v3 <= v2:
				print('YES')
			else:
				print('NO')
		elif v2 * c2 / c1 >= v3 and v1 * (t2 - t1) / (t2 - t3) >= v3:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = list(map(int, input().strip().split()))
	flag = 1
	if t1 > t2:
		if t3 > t1 or t3 < t2:
			print('NO')
			continue
	elif t3 > t2 or t3 < t1:
		print('NO')
		continue
	vx = v3 * (t3 - t2) / (t1 - t2)
	if vx < 0 or vx > v1:
		print('NO')
		continue
	vy = v3 - vx
	if vy < 0 or vy > v2:
		print('NO')
		continue
	print('YES')


n = int(input())
for _ in range(n):
	l = list(map(int, input().split()))
	v1 = l[0]
	t1 = l[1]
	v2 = l[2]
	t2 = l[3]
	v3 = l[4]
	t3 = l[5]
	if t3 <= t2 and t3 > t1:
		a = (t2 - t3) / (t3 - t1)
		x2 = v3 / (a + 1)
		if x2 <= v2 and v3 - x2 <= v1:
			print('YES')
		else:
			print('NO')
	elif t3 == t1:
		if v3 <= v1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = list(map(int, input().split()))
	if t1 == t2 and v3 <= v1 + v2:
		print('YES')
	else:
		b = v3 * (t3 - t1) / (t2 - t1)
		a = v3 - b
		if a >= 0 and a <= v1 and (b >= 0) and (b <= v2):
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	Vx = v3 * (t2 - t3) / (t2 - t1)
	Vy = v3 * (t3 - t1) / (t2 - t1)
	if Vx >= 0 and Vx <= v1 and (Vy >= 0) and (Vy <= v2):
		print('YES')
	else:
		print('NO')


def __starting_point():
	for t in range(int(input())):
		yes = False
		(v1, t1, v2, t2, v3, t3) = map(int, input().split())
		if t1 <= t3 <= t2:
			yes = (t2 - t3) * v3 <= v1 * (t2 - t1) and (t3 - t1) * v3 <= v2 * (t2 - t1)
		print('YES' if yes else 'NO')
__starting_point()


import sys
import math
import copy
import heapq
import bisect
import string
import functools
import itertools
import collections
t = int(sys.stdin.readline())
while t > 0:
	(v1, t1, v2, t2, v3, t3) = list(map(int, sys.stdin.readline().strip().split()))
	if t1 == t3 and t2 == t3:
		if v1 + v2 >= v3:
			sys.stdout.write(str('YES') + '\n')
		else:
			sys.stdout.write(str('NO') + '\n')
	elif t1 == t3:
		if v1 >= v3:
			sys.stdout.write(str('YES') + '\n')
		else:
			sys.stdout.write(str('NO') + '\n')
	elif t2 == t3:
		if v2 >= v3:
			sys.stdout.write(str('YES') + '\n')
		else:
			sys.stdout.write(str('NO') + '\n')
	elif t3 < min(t1, t2) or t3 > max(t1, t2):
		sys.stdout.write(str('NO') + '\n')
	else:
		x = float(1) + float(t1 - t3) / float(t3 - t2)
		if x == 0:
			sys.stdout.write(str('NO') + '\n')
		else:
			z = v3 / x
			if z >= 0 and z <= v1 and (v3 - z >= 0) and (v3 - z <= v2):
				sys.stdout.write(str('YES') + '\n')
			else:
				sys.stdout.write(str('NO') + '\n')
	t = t - 1


t = int(input())
for _ in range(0, t):
	a = input()
	b = a.split()
	v1 = int(b[0])
	t1 = int(b[1])
	v2 = int(b[2])
	t2 = int(b[3])
	v3 = int(b[4])
	t3 = int(b[5])
	max = t3 * v3
	num = 0
	flag = False
	reqv2 = (t3 * v3 - t1 * v3) / (t2 - t1)
	reqv1 = v3 - reqv2
	if t1 == t3 and v1 == v3 or (t2 == t3 and v2 == v3):
		print('YES')
	elif reqv2 < v2 and reqv1 < v1 and (reqv2 >= 0) and (reqv1 >= 0):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	if t1 == t3 and t3 == t2:
		if v1 + v2 > v3:
			print('YES')
		else:
			print('NO')
	elif t1 == t2:
		if v1 >= v3:
			print('YES')
		else:
			print('NO')
		continue
	l = v3 * (t1 - t3) / (t1 - t2)
	r = (v1 + v2) * (t1 - t3) / (t1 - t2)
	l1 = v3 * (t3 - t2) / (t1 - t2)
	r1 = (v1 + v2) * (t3 - t2) / (t1 - t2)
	if l <= min(v2, r) and l1 <= min(v1, r1):
		print('YES')
	else:
		print('NO')


import math
n = int(input())
while n:
	n -= 1
	a = [int(x) for x in input().split()]
	num = a[3] - a[5]
	dno = a[5] - a[1]
	if num < 0 or dno < 0:
		print('NO')
		continue
	g = math.gcd(num, dno)
	num /= g
	dno /= g
	total_parts = num + dno
	volume_of_part = a[4] / total_parts
	if volume_of_part * num > a[0]:
		print('NO')
		continue
	if volume_of_part * dno > a[2]:
		print('NO')
		continue
	print('YES')


for i in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	vx = v3 * (t3 - t2) / (t1 - t2)
	if vx < 0:
		print('NO')
	elif vx <= v1 and v3 - vx <= v2 and (v3 - vx >= 0):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	res = 'NO'
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	if t1 == t3:
		if v1 >= v3:
			res = 'YES'
	elif t2 == t3:
		if v2 >= v3:
			res = 'YES'
	else:
		T = (t3 - t2) / (t1 - t3)
		if T > 0:
			if v3 / (1 + T) <= min(v2, v1 / T):
				res = 'YES'
	print(res)


T = int(input())
for _ in range(T):
	arr = [int(i) for i in input().split()]
	v1 = arr[0]
	t1 = arr[1]
	v2 = arr[2]
	t2 = arr[3]
	v3 = arr[4]
	t3 = arr[5]
	if v3 > v1 + v2:
		print('NO')
	elif t3 == t1:
		if v1 >= v3:
			print('YES')
		else:
			print('NO')
	elif t3 == t2:
		if v2 >= v3:
			print('YES')
		else:
			print('NO')
	else:
		alpha = (t2 - t3) / (t3 - t1)
		vh = v3 / (1 + alpha)
		vc = alpha * v3 / (1 + alpha)
		if vc > v1 or vh > v2 or vh < 0 or (vc < 0):
			print('NO')
		else:
			print('YES')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split(' '))
	if t1 < t3 and t2 < t3:
		print('NO')
		continue
	elif t1 > t3 and t2 > t3:
		print('NO')
		continue
	elif v1 + v2 < v3:
		print('NO')
		continue
	else:
		if t2 == t1:
			print('YES')
			continue
		deltat = max(t1, t2) - min(t1, t2)
		if v2 >= (t1 - t3) * v3 / (t1 - t2) and v1 >= (t3 - t2) * v3 / (t1 - t2):
			print('YES')
		else:
			print('NO')


import sys
t = int(input())
while t:
	line = input().split()
	(v1, t1, v2, t2, v3, t3) = (int(line[0]), int(line[1]), int(line[2]), int(line[3]), int(line[4]), int(line[5]))
	if t3 < t1 or t3 > t2:
		sys.stdout.write('NO\n')
	elif v3 * (t3 - t2) / (t1 - t2) > v1:
		sys.stdout.write('NO\n')
	elif v3 * (t1 - t3) / (t1 - t2) > v2:
		sys.stdout.write('NO\n')
	else:
		sys.stdout.write('YES\n')
	t -= 1


t = int(input())
for you in range(t):
	l = input().split()
	v1 = int(l[0])
	t1 = int(l[1])
	v2 = int(l[2])
	t2 = int(l[3])
	v3 = int(l[4])
	t3 = int(l[5])
	if t2 > t1:
		(t1, t2) = (t2, t1)
		(v1, v2) = (v2, v1)
	if t3 - t2 < 0:
		print('NO')
		continue
	if v3 * t3 - v3 * t2 > v1 * (t1 - t2):
		print('NO')
		continue
	if t3 - t2 > t1 - t2:
		print('NO')
		continue
	if (v3 - v2) * (t1 - t2) > v3 * (t3 - t2):
		print('NO')
		continue
	print('YES')


for _ in range(int(input())):
	(v1, t1, v2, t2, v3, t3) = map(int, input().split())
	comp_v2 = (t1 - t3) / (t1 - t2) * v3
	comp_v1 = (t3 - t2) / (t1 - t2) * v3
	if (comp_v1 >= 0 and comp_v1 <= v1) and (comp_v2 >= 0 and comp_v2 <= v2):
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	A = input()
	(v1, t1, v2, t2, v3, t3) = (int(A.split()[0]), int(A.split()[1]), int(A.split()[2]), int(A.split()[3]), int(A.split()[4]), int(A.split()[5]))
	if t3 >= t1 and t3 <= t2 and (v3 <= v1 + v2):
		vy = v3 * (t3 - t1) / (t2 - t1)
		vx = v3 - vy
		if vx <= v1 and vy <= v2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')