You are given four integer values $a$, $b$, $c$ and $m$.

Check if there exists a string that contains:

$a$ letters 'A';

$b$ letters 'B';

$c$ letters 'C';

no other letters;

exactly $m$ pairs of adjacent equal letters (exactly $m$ such positions $i$ that the $i$-th letter is equal to the $(i+1)$-th one).


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 10^4$) — the number of testcases.

Each of the next $t$ lines contains the description of the testcase — four integers $a$, $b$, $c$ and $m$ ($1 \le a, b, c \le 10^8$; $0 \le m \le 10^8$).


-----Output-----

For each testcase print "YES" if there exists a string that satisfies all the requirements. Print "NO" if there are no such strings.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).


-----Examples-----

Input
3
2 2 1 0
1 1 1 1
1 2 3 2
Output
YES
NO
YES


-----Note-----

In the first testcase strings "ABCAB" or "BCABA" satisfy the requirements. There exist other possible strings.

In the second testcase there's no way to put adjacent equal letters if there's no letter that appears at least twice.

In the third testcase string "CABBCC" satisfies the requirements. There exist other possible strings.

Difficulty: EASY
Tags: Combinatorics

Mathematics

Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
from sys import stdin, stdout
from collections import Counter, deque
from math import *
from functools import reduce
cin = stdin.readline
cout = stdout.write
mod = pow(10, 9) + 7

def inpn():
	return int(cin())

def inpl():
	return list(map(int, cin().split()))

def inpset():
	return set(map(int, cin().split()))

def inps():
	return cin()[:-1]

def inpv():
	return map(int, cin().split())

def inpvf():
	return map(float, cin().split())

def outs(s):
	cout(s)

def outn(n):
	cout(str(n))

def outl(l):
	for i in l:
		cout(str(i) + ' ')

def outb(s):
	cout(str(s))

def endl():
	cout('\n')

def solution():
	(a, b, c, m) = inpv()
	curSUm = a + b + c
	x = curSUm // 2 + curSUm % 2
	maxiumu = a - 1 + b - 1 + c - 1
	minPos = 0
	if a > x:
		if curSUm % 2 != 0:
			minPos = 2 * (a - x)
		else:
			minPos = 2 * (a - x - 1) + 1
	elif b > x:
		if curSUm % 2 != 0:
			minPos = 2 * (b - x)
		else:
			minPos = 2 * (b - x - 1) + 1
	elif c > x:
		if curSUm % 2 != 0:
			minPos = 2 * (c - x)
		else:
			minPos = 2 * (c - x - 1) + 1
	if m <= maxiumu and m >= minPos:
		outs('Yes')
		endl()
		return
	outs('NO\n')
testCases = inpn()
for testCase in range(testCases):
	solution()


N = []
for _ in range(int(input())):
	N.append([int(x) for x in input().split(' ')])
for n in N:
	(f, s, t) = sorted(n[:3])
	m = n[-1]
	(fmin, fmax) = [max(s - (f + 1), 0), max(0, f - 1 + s - 1)]
	(lmin, lmax) = [max(0, t - (s + f + 1)), max(0, t - 1 + fmax)]
	if lmin <= m <= lmax:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	lst = list(map(int, input().split()))
	a = lst[0]
	b = lst[1]
	c = lst[2]
	m = lst[3]
	min_m = max(0, 2 * max(a, b, c) - a - b - c - 1)
	max_m = a + b + c - 3
	if min_m <= m <= max_m:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.buffer.readline

def solve(a, b, c, m):
	n = a + b + c
	maxpos = a - 1 + (b - 1) + (c - 1)
	maxi = max(a, b, c)
	mini = min(a, b, c)
	medi = n - maxi - mini
	minpos = maxi - mini - medi - 1
	if m > n - 1 or m > maxpos or minpos > m:
		return 'NO'
	else:
		return 'YES'
T = int(input())
for i in range(T):
	(a, b, c, m) = map(int, input().split())
	print(solve(a, b, c, m))


import sys
t_str = sys.stdin.readline().rstrip()
if t_str != '':
	t = int(t_str)
	while t > 0:
		(a, b, c, m) = [int(num) for num in sys.stdin.readline().rstrip().split(' ')]
		if a - 1 > b + c + m or b - 1 > a + c + m or c - 1 > b + a + m:
			print('NO')
		elif a + b + c - 3 >= m:
			print('YES')
		else:
			print('NO')
		t -= 1


def get_input():
	t = int(input())
	ta = []
	for i in range(t):
		ta.append([int(d) for d in input().split(' ')])
	return ta

def solve(n):
	p = n[-1]
	n = n[:-1]
	n = sorted(n)
	if p <= n[0] + n[1] + n[2] - 3 and p >= n[2] - n[1] - n[0] - 1:
		return 'YES'
	return 'NO'

def main():
	ta = get_input()
	for t in ta:
		print(solve(t))
main()


n = int(input())
while n > 0:
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	if c - (a + b + 1) <= m and m <= a + b + c - 3:
		print('YES')
	else:
		print('NO')
	n -= 1


for t in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	l = [a, b, c]
	l.sort()
	m = l[2] - (l[0] + l[1])
	n = 0 if m <= 0 else m - 1
	q = 'YES' if n <= d and sum(l) - 3 >= d else 'NO'
	print(q)


t = int(input())
for i in range(t):
	s = input().split()
	a = int(s[0])
	b = int(s[1])
	c = int(s[2])
	m = int(s[3])
	res = a - 1 + (b - 1) + (c - 1)
	if a >= b and a >= c:
		m1 = a
		s[0] = '!'
	elif b >= a and b >= c:
		m1 = b
		s[1] = '!'
	else:
		m1 = c
		s[2] = '!'
	if s[0] != '!' and (a >= b or a >= c):
		s[0] = '!'
		m2 = a
	elif s[1] != '!' and (b >= a or b >= c):
		s[1] = '!'
		m2 = b
	else:
		s[2] = '!'
		m2 = c
	if s[0] == '!' and s[1] == '!':
		m3 = c
	elif s[0] == '!' and s[2] == '!':
		m3 = b
	else:
		m3 = a
	if res >= m and m1 - (m2 + m3) - 1 <= m:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	s = max(0, a - 1) + max(0, b - 1) + max(0, c - 1)
	f = max(a, b, c) - min(max(a, b, c), sum(sorted([a, b, c])[:2]) + 1)
	if m >= f and m <= s:
		print('YES')
	else:
		print('NO')


def solve(a, b, c, m):
	ma = sum([a, b, c]) - 3
	mi = max(0, max([a - b - c - 1, b - c - a - 1, c - a - b - 1]))
	if m <= ma and m >= mi:
		return 'YES'
	return 'NO'

def main():
	ans = []
	t = int(input())
	for _ in range(t):
		(a, b, c, m) = map(int, input().split(' '))
		ans.append(solve(a, b, c, m))
	for p in ans:
		print(p)
main()


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	if a - 1 > b + c + m or b - 1 > a + c + m or c - 1 > a + b + m:
		print('NO')
	elif a + b + c - 3 >= m:
		print('YES')
	else:
		print('NO')


t = int(input())

def main():
	for i in range(t):
		func()

def func():
	(a, b, c, m) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	m = int(m)
	l = [a, b, c]
	l = sorted(l)
	d = a - 1 + (b - 1) + (c - 1)
	if d >= m:
		k = l[2] - (l[1] + l[0] + 1)
		if m >= k:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
main()


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	lst = sorted([a, b, c])
	mx = a - 1 + (b - 1) + (c - 1)
	if mx >= m:
		x = lst[2] - (lst[1] + lst[0] + 1)
		if m >= x:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def combinatorics_homework(a, b, c, m):
	check_have = a - 1 + b - 1 + c - 1
	if check_have < m:
		return False
	l = sorted([a, b, c])
	if l[2] - l[1] - l[0] - 1 > m:
		return False
	return True
n = int(input())
test_case = list()
for i in range(n):
	s = input()
	a = list(map(int, s.split()))
	test_case.append(a)
for d in test_case:
	(a, b, c, m) = (d[0], d[1], d[2], d[3])
	if combinatorics_homework(a, b, c, m):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	l = [a, b, c]
	l = sorted(l)
	ex = l[-1] - (1 + l[0] + l[1])
	ex = max(0, ex)
	if ex <= m <= a + b + c - 3:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, m) = map(int, input().split())
	max = a + b + c - 3
	sequence = [a, b, c]
	sequence.sort()
	(i_0, i_1, i_2) = (sequence[0], sequence[1], sequence[2])
	if i_0 + i_1 - i_2 < 0:
		min = -i_0 - i_1 + i_2 - 1
	elif i_0 + i_1 - i_2 >= 0:
		min = 0
	if min <= m <= max:
		output = 'YES'
	else:
		output = 'NO'
	print(output)


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	print('YES' if a + b + c - 3 >= m and m >= 2 * max(a, b, c) - a - b - c - 1 else 'NO')


t = int(input())
for _ in range(t):
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	(min_limit, max_limit) = (max(c - b - a - 1, 0), a + b + c - 3)
	if min_limit <= m and m <= max_limit:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(a, b, c, m) = input().split()
	val = []
	a = int(a)
	b = int(b)
	c = int(c)
	m = int(m)
	val.append(a)
	val.append(b)
	val.append(c)
	val.sort()
	if m > a - 1 + b - 1 + c - 1:
		str = 'NO'
	else:
		k = val[2] - (val[1] + val[0] + 1)
		if m >= k:
			str = 'YES'
		else:
			str = 'NO'
	print(str)


from sys import stdin, stdout, setrecursionlimit
from io import BytesIO, IOBase
from bisect import bisect_left as bl, bisect_right as br, bisect as bis
setrecursionlimit(10000)

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None
		self.BUFSIZE = 8192

	def read(self):
		while True:
			a = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			if not a:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(a), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			a = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			self.newlines = a.count(b'\n') + (not a)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(a), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
input = lambda : stdin.readline().rstrip('\r\n')
inp = lambda : int(input())
st = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
int_arr = lambda : list(map(int, input().strip().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().strip().split())
get_int = lambda : map(int, input().strip().split())
get_float = lambda : map(float, input().strip().split())
mod = 1000000007
for _ in range(inp()):
	(a, b, c, m) = get_int()
	mn = max(0, max(a, b, c) - (a + b + c - max(a, b, c)) - 1)
	if m >= mn and m <= a + b + c - 3:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	if m > a + b + c - 3:
		print('NO')
	else:
		t = [a, b, c]
		t.sort()
		if m >= t[2] - (t[1] + t[0] + 1):
			print('YES')
		else:
			print('NO')


n = int(input())
for i in range(n):
	(a, b, c, m) = map(int, input().split())
	t = a + b + c
	f = 2 * max(a, b, c) - t
	if t >= m + 3 and f <= m + 1:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	max_l = max([a, b, c])
	print('YES' if 2 * max_l - (a + b + c + 1) <= m <= a + b + c - 3 else 'NO')


def read_stuff():
	n = int(input())
	array = []
	for i in range(n):
		row = []
		(one, two, three, four) = map(int, input().strip().split())
		row.append(one)
		row.append(two)
		row.append(three)
		row.append(four)
		array.append(row)
	for i in range(n):
		a = array[i][0]
		b = array[i][1]
		c = array[i][2]
		m = array[i][3]
		done = False
		if a - 1 + (b - 1) + (c - 1) < m:
			print('NO')
			done = True
		elif a > b + c:
			if abs(b + c - a) - 1 > m:
				print('NO')
				done = True
		elif b > a + c:
			if abs(a + c - b) - 1 > m:
				print('NO')
				done = True
		elif c > b + a:
			if abs(a + b - c) - 1 > m:
				print('NO')
				done = True
		if not done:
			print('YES')
read_stuff()


t = int(input())
while t:
	(a, b, c, m) = map(int, input().split())
	if a - 1 > b + c + m or b - 1 > a + c + m or c - 1 > a + b + m:
		print('NO')
	elif a + b + c - 3 >= m:
		print('YES')
	else:
		print('NO')
	t -= 1


def main():
	(a, b, c, n) = map(int, input().split())
	x = [a, b, c]
	x.sort()
	(a, b, c) = (x[0], x[1], x[2])
	mini = max(0, c - 1 - a - b)
	maxi = max(0, a - 1) + max(b - 1, 0) + max(c - 1, 0)
	if n < mini or n > maxi:
		print('NO')
	else:
		print('YES')
t = int(input())
for i in range(t):
	main()


def prb():
	l = list(map(int, input().split()))
	m = l[3]
	l.remove(l[3])
	l.sort()
	a = l[0]
	b = l[1]
	c = l[2]
	if a + b + c - 3 < m:
		return 'NO'
	if c - (m + 1) > b + a:
		return 'NO'
	return 'YES'
for _ in range(int(input())):
	print(prb())


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	mx = a + b + c - 3
	x = [a, b, c]
	x.sort()
	rem = x[2] - x[0] - x[1]
	if m > mx or m < rem - 1:
		print('no')
		continue
	print('yes')


T = int(input())
for t in range(T):
	(a, b, c, m) = map(int, input().split())
	d = a + b + c - 3
	e = max([a, b, c]) - (a + b + c - max([a, b, c])) - 1
	if m >= e and m <= d:
		print('YES')
	else:
		print('NO')


import math
t = int(input())
for _ in range(t):
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	print('YES' if c - 1 - a - b <= m <= a + b + c - 3 else 'NO')


def max(list):
	highest_value_position = 0
	maximum = list[0]
	for position in range(len(list) - 1):
		if list[position] > maximum:
			maximum = list[position]
			highest_value_position = position
	return highest_value_position

def judge(list):
	max_position = max(list)
	max_value = list[max_position] - 1
	highest_adjacent = 0
	lowest = 0
	for i in range(len(list) - 1):
		highest_adjacent = highest_adjacent + list[i] - 1
		if i != max_position:
			max_value = max_value - list[i]
	if max_value < 0:
		lowest = 0
	else:
		lowest = max_value
	if highest_adjacent >= list[3] >= lowest:
		return True
	else:
		return False
int_list_2D = []
t = int(input())
for i in range(t):
	int_list = []
	(a, b, c, m) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	m = int(m)
	int_list.append(a)
	int_list.append(b)
	int_list.append(c)
	int_list.append(m)
	int_list_2D.append(int_list)
for list in int_list_2D:
	y = judge(list)
	if y:
		print('YES')
	else:
		print('NO')


test = int(input())

def min_pair(x, y, z):
	num = [x, y, z]
	num.sort()
	sum = num[2] - num[1] - num[0] - 1
	return sum
for case in range(test):
	(a, b, c, m) = input().split()
	(a, b, c, m) = (int(a), int(b), int(c), int(m))
	n = min_pair(a, b, c)
	if a + b + c - 3 >= m >= n:
		print('YES')
	else:
		print('NO')


import sys
import bisect
from bisect import bisect_left as lb
from bisect import bisect_right as rb
input_ = lambda : sys.stdin.readline().strip('\r\n')
from math import log
from math import gcd
from math import atan2, acos
from random import randint
sa = lambda : input_()
sb = lambda : int(input_())
sc = lambda : input_().split()
sd = lambda : list(map(int, input_().split()))
sflo = lambda : list(map(float, input_().split()))
se = lambda : float(input_())
sf = lambda : list(input_())
flsh = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
mod1 = 998244353
gp = []
cost = []
dp = []
mx = []
ans1 = []
ans2 = []
special = []
specnode = []
a = 0
kthpar = []

def dfs2(root, par):
	if par != -1:
		dp[root] = dp[par] + 1
	for i in range(1, 20):
		if kthpar[root][i - 1] != -1:
			kthpar[root][i] = kthpar[kthpar[root][i - 1]][i - 1]
	for child in gp[root]:
		if child == par:
			continue
		kthpar[child][0] = root
		dfs(child, root)
ans = 0
b = []
vis = []
tot = 0
time = []
time1 = []
adj = []
mx = -1
eps = 1e-07

def hnbhai(tc):
	(a, b, c, m) = sd()
	x = [a, b, c]
	x.sort()
	mn = 0
	mx = sum(x) - 3
	ok = x[-1] - x[-2] - x[-3]
	if ok > 0:
		mn = ok - 1
	if m >= mn and m <= mx:
		print('YES')
		return
	print('NO')
	return
for _ in range(sb()):
	hnbhai(_ + 1)


n = int(input())
inputs = []
for i in range(n):
	inputs.append(str(input()).split(' '))
for j in inputs:
	for t in range(len(j)):
		j[t] = int(j[t])
for q in inputs:
	(a, b, c, m) = q
	(a, b, c, m) = (int(a), int(b), int(c), int(m))
	count = 0
	avalue = 0
	bvalue = 0
	cvalue = 0
	if a >= b and a >= c:
		maxt = 'a'
	elif b >= a and b >= c:
		maxt = 'b'
	elif c >= a and c >= b:
		maxt = 'c'
	if a >= 2:
		count += 1
		avalue = a
	if b >= 2:
		count += 1
		bvalue = b
	if c >= 2:
		count += 1
		cvalue = c
	if m <= avalue + bvalue + cvalue - count:
		if maxt == 'a' and m >= a - (b + c) - 1 or (maxt == 'b' and m >= b - (a + c) - 1) or (maxt == 'c' and m >= c - (a + b) - 1):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


INF = 10 ** 18
import sys
import pprint
import logging
from logging import getLogger
import array

def input():
	return sys.stdin.readline().rstrip('\r\n')

def maps():
	return [int(i) for i in input().split()]
logging.basicConfig(format='%(message)s', level=logging.WARNING)
logger = getLogger(__name__)
logger.setLevel(logging.INFO)

def debug(msg, *args):
	logger.info(f'{msg}={pprint.pformat(args)}')
for i in range(*maps()):
	(a, b, c, m) = maps()
	A = [a, b, c]
	A.sort()
	A = A[::-1]
	least_m = A[0] - A[1] - A[2] - 1
	most_m = max(0, A[0] - 1) + max(0, A[1] - 1) + max(0, A[2] - 1)
	if m < least_m or m > most_m:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout

def main():
	for _ in range(int(stdin.readline())):
		arr = [int(x) for x in stdin.readline().split()]
		pairs = arr[0] + arr[1] + arr[2] - 3
		if pairs >= arr[3] and pairs + 3 - max(arr[0], arr[1], arr[2]) >= max(arr[0], arr[1], arr[2]) - 1 - arr[3]:
			stdout.write('YES\n')
		else:
			stdout.write('NO\n')
main()


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	if a < b:
		(a, b) = (b, a)
	if a < c:
		(a, c) = (c, a)
	if b < c:
		(b, c) = (c, b)
	min_adjacent = a - (b + c) - 1
	if min_adjacent <= m <= a - 1 + b - 1 + c - 1:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b, c, m) = map(int, input().strip().split())
	(a, b, c) = sorted([a, b, c])
	if m > 0:
		todel = min(c - b, m)
		m -= todel
		c -= todel
	if m > 0:
		todel = min((b - a) * 2, m)
		todel2 = todel // 2
		m -= todel2 * 2
		c -= todel2
		b -= todel2
	if m > 0:
		todel = min((a - 1) * 3, m)
		todel3 = todel // 3
		m -= todel3 * 3
		c -= todel3
		b -= todel3
		a -= todel3
	ok = True
	if m > 0:
		ok = sum([a, b, c]) - 3 >= m
	else:
		ok = a + b >= c - 1
	print('YES' if ok else 'NO')


T = int(input())
for i in range(T):
	(a, b, c, m) = map(int, input().split())
	arr = [a, b, c]
	arr.sort()
	if m > a - 1 + b - 1 + c - 1:
		print('NO')
	else:
		k = arr[2] - arr[1] - arr[0] - 1
		if m >= k:
			print('YES')
		else:
			print('No')


from sys import stdin
input = stdin.readline
for i in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	mx = a - 1 + b - 1 + c - 1
	x = sorted([a, b, c])
	mn = x[2] - x[1] - x[0] - 1
	if m >= mn and m <= mx:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	if m > a + b + c - 3:
		print('NO')
		continue
	else:
		abc = sorted([a, b, c])
		if m < abc[2] - abc[1] - abc[0] - 1:
			print('NO')
			continue
	print('YES')


from sys import stdin
input = stdin.readline
rn = lambda : int(input())
rns = lambda : map(int, input().split())
rl = lambda : list(map(int, input().split()))
rs = lambda : input().strip()
YN = lambda x: print('YES') if x else print('NO')
mod = 10 ** 9 + 7
for _ in range(rn()):
	(a, b, c, m) = rns()
	(a, b, c) = sorted([a, b, c], reverse=True)
	ma = a + b + c - 3
	mi = a - b - 1
	mi = max(0, mi - c)
	YN(mi <= m <= ma)


for t in range(int(input())):
	(a, b, c, m) = list(map(int, input().split()))
	l = [a, b, c]
	l.sort()
	if l[0] + l[1] >= l[-1] - 1:
		if m >= 0 and m <= a + b + c - 3:
			print('YES')
		else:
			print('NO')
	else:
		mmin = l[-1] - (l[0] + l[1] + 1)
		if m >= mmin and m <= a + b + c - 3:
			print('YES')
		elif mmin >= a + b + c - 3 and m >= mmin:
			print('YES')
		else:
			print('NO')


import sys
input = sys.stdin.readline
for i in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	if a + b + c - 3 < m:
		print('NO')
		continue
	(a, b, c) = sorted([a, b, c])
	if c - a - b - 1 > m:
		print('NO')
		continue
	print('YES')


from collections import deque, Counter
from collections import defaultdict as dfd
from bisect import bisect, bisect_left
from math import sqrt, gcd, ceil, factorial, log2
from heapq import heapify, heappush, heappop
MOD = 10 ** 9 + 7
inf = float('inf')
ans_ = []

def nin():
	return int(input())

def ninf():
	return int(file.readline())

def st():
	return input().strip()

def stf():
	return file.readline().strip()

def read():
	return list(map(int, input().strip().split()))

def readf():
	return list(map(int, file.readline().strip().split()))

def readfl():
	return list(map(float, input().strip().split()))

def readffl():
	return list(map(float, file.readline().strip().split()))

def solve():
	for _ in range(nin()):
		(a, b, c, m) = read()
		(a, b, c) = sorted([a, b, c])
		mini = c - (a + b + 1)
		maxi = a + b + c - 3
		if mini <= m <= maxi:
			ans_.append('YES')
		else:
			ans_.append('NO')
solve()
for i in ans_:
	print(i)


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	mx = a + b + c - 3
	tempA = a
	tempB = b
	tempC = c
	a = max(a, b, c)
	c = min(tempA, b, c)
	b = tempA + tempB + tempC - a - c
	t = a - c
	mn = max(0, t - b) - 1
	if m >= mn and m <= mx:
		print('YES')
	else:
		print('NO')


for iii in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	maxx = a + b + c - 3
	summ = a + b + c
	maxi = max(a, b, c)
	maxi2 = summ - maxi
	mini = 0
	if maxi2 >= maxi:
		mini = 0
	else:
		mini = maxi - maxi2 - 1
	if mini <= m <= maxx:
		print('YES')
	else:
		print('NO')


from sys import stdout, stdin
from io import IOBase, BytesIO
from os import read, write, fstat
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size: int=...):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))

def input():
	return stdin.readline().rstrip('\r\n')
YES = 'YES'
NO = 'NO'

def main():
	t = int(input())
	for _ in range(t):
		(a, b, c, m) = map(int, input().split())
		top_max_m = a + b + c - 3
		arr = [a, b, c]
		arr = sorted(arr)
		min_value = arr[0]
		mid_value = arr[1]
		max_value = arr[2]
		if m > top_max_m or max_value > mid_value + min_value + 1 + m:
			print(NO)
		else:
			print(YES)
main()


import sys
input = sys.stdin.readline
t = int(input())
while t > 0:
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	if a + b + c - 3 >= m >= c - a - b - 1:
		print('YES')
	else:
		print('NO')
	t -= 1


def main():
	for test in range(int(input())):
		(a, b, c, m) = map(int, input().split())
		x = 0
		letters = sorted([a, b, c])
		for i in letters:
			if i != 0:
				x += 1
		all_pairs = a + b + c - x
		if m > all_pairs:
			print('NO')
		elif m == all_pairs:
			print('YES')
		else:
			if letters[0] + letters[1] > letters[2]:
				print('YES')
				continue
			else:
				temp = letters[2] - letters[1] - letters[0]
			if temp != 0:
				temp -= 1
			if m < temp:
				print('NO')
			else:
				print('YES')
main()


def yes():
	print('YES')

def no():
	print('NO')
for test in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	if m <= a + b + c - 3 and m >= c - a - b - 1:
		yes()
	else:
		no()


for i in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	maxi = a + b + c - 3
	mini = max(a, b, c) - (a + b + c - max(a, b, c) + 1)
	if m > maxi:
		print('NO')
	elif m < mini:
		print('NO')
	else:
		print('YES')


def f(a, b, c, m):
	maxpairs = a - 1 + (b - 1) + (c - 1)
	m1 = max(a, b, c)
	if m1 == a:
		minpairs = max(a - b - c - 1, 0)
	elif m1 == b:
		minpairs = max(b - c - a - 1, 0)
	else:
		minpairs = max(c - a - b - 1, 0)
	if minpairs <= m <= maxpairs:
		return 'YES'
	else:
		return 'NO'
t = int(input())
l = []
for i in range(t):
	(a, b, c, m) = map(int, input().split())
	s = f(a, b, c, m)
	l.append(s)
for i in l:
	print(i)


for s in [*open(0)][1:]:
	(*a, m) = map(int, s.split())
	print('NYOE S'[2 * max(a) - m - 2 < sum(a) > m + 2::2])


from heapq import *
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	(a, b, c, m) = ma()
	z = a + b + c - 3
	if m > z:
		print('NO')
		continue
	f = [a, b, c]
	f.sort()
	limit = f[-1] - f[0] - f[1] - 1
	limit = max(0, limit)
	if m < limit:
		print('NO')
	else:
		print('YES')


def il():
	return list(map(int, input().split()))

def ii():
	return int(input())

def imi():
	return map(int, input().split())

def ist():
	return input()
t = ii()
for _ in range(t):
	(a, b, c, m) = imi()
	x = max(a, b, c)
	if m > a + b + c - 3:
		print('NO')
	elif m < 2 * x - (1 + a + b + c):
		print('NO')
	else:
		print('YES')


time = eval(input())
tz = []
for i in range(time):
	num = input().split()
	num = [int(x) for x in num]
	p = int(num[0]) - 1 + (int(num[1]) - 1) + (int(num[2]) - 1)
	s = num[:-1]
	s.sort()
	m = s[-1] - s[-2] - s[-3] - 1
	if m < 0:
		m = 0
	if m <= int(num[3]) <= p:
		tz.append('YES')
	else:
		tz.append('NO')
for i in tz:
	print(i)


def CombiH(A):
	m = A[3]
	tA = A[0:3]
	tA.sort()
	Max = tA[0] + tA[1] + tA[2] - 3
	Min = tA[2] - 1 - tA[1] - tA[0]
	if m >= Min and m <= Max:
		print('YES')
	else:
		print('NO')
	return 0
num_of_case = int(input())
list_of_case = []
for i in range(num_of_case):
	I = input().split()
	for j in range(4):
		I[j] = int(I[j])
	list_of_case.append(I)
for i in range(num_of_case):
	CombiH(list_of_case[i])


n = m = int(input())
a = []
for j in range(m):
	l = input().split()
	l = list(map(int, l))
	m = l.pop(3)
	l.sort()
	mx = l[0] + l[1] + l[2] - 3
	mn = max(0, l[2] - l[1] - l[0] - 1)
	if (m >= mn) & (m <= mx):
		a.append(1)
	else:
		a.append(0)
for i in range(n):
	if a[i] == 1:
		print('YES')
	else:
		print('NO')


from __future__ import division, print_function
import heapq
import os
import copy
import sys
from io import BytesIO, IOBase
from typing import Counter, DefaultDict
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	t = int(input())
	while t:
		(a, b, c, m) = map(int, input().split())
		arr = [a, b, c]
		arr.sort()
		mx = a + b + c - 3
		mn = arr[2] - arr[1] - arr[0] - 1
		if m >= mn and m <= mx:
			print('YES')
		else:
			print('NO')
		t -= 1
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
import math
t = int(sys.stdin.readline())
for test in range(t):
	(a, b, c, m) = map(int, sys.stdin.readline().split())
	total = a + b + c
	key = max(a, b, c)
	most = total - 3
	least = max(0, 2 * key - total - 1)
	if least <= m <= most:
		print('YES')
	else:
		print('NO')


def combinatorics(a, b, c, m):
	ceiling = a - 1 + b - 1 + c - 1
	(x, y, z) = sorted([a, b, c])
	floor = z - x - y - 1
	if floor <= m <= ceiling:
		return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	(a, b, c, m) = map(int, input().split(' '))
	print(combinatorics(a, b, c, m))


for s in [*open(0)][1:]:
	(a, b, c, k) = map(int, s.split())
	(a, b, c) = sorted([a, b, c])
	M = sum((x - 1 for x in [a, b, c]))
	m = max(0, c - b - a - 1)
	print('NYOE S'[m <= k <= M::2])


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	l = [a, b, c]
	l.sort()
	(a, b, c) = (l[0], l[1], l[2])
	mx = a + b + c - 3
	if c - 1 <= a + b:
		mn = 0
	else:
		mn = c - 1 - a - b
	if mn <= m <= mx:
		print('YES')
	else:
		print('NO')


from sys import stdin, gettrace
if gettrace():

	def inputi():
		return input()
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	dm = min(m, c - 1, c - b)
	c -= dm
	m -= dm
	dm = min(m // 2, b - 1, b - a)
	c -= dm
	b -= dm
	m -= 2 * dm
	dm = min(m // 3, a - 1)
	c -= dm
	b -= dm
	a -= dm
	m -= 3 * dm
	if m > 2 or (m == 2 and b == 1) or (m == 1 and c == 1):
		print('NO')
		return
	elif m == 1:
		if c > b:
			c -= 1
		else:
			b -= 1
	elif m == 2:
		c -= 1
		b -= 1
	if c > a + b + 1:
		print('NO')
	else:
		print('YES')

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


import sys
input = sys.stdin.readline

def solve():
	(a, b, c, m) = map(int, input().split())
	if m > a - 1 + b - 1 + c - 1:
		print('NO')
		return
	if a > b:
		(a, b) = (b, a)
	if a > c:
		(a, c) = (c, a)
	if b > c:
		(b, c) = (c, b)
	e = c - 1
	w = min(e, b)
	e -= w
	b -= w
	d = 2 * w
	if b > 0:
		d += b
		e += b - 1
	w = min(e, a)
	e -= w
	a -= w
	if a > 0:
		w = min(d, a)
		a -= w
		d -= w
		e += max(a - 1, 0)
	if m < e:
		print('NO')
	else:
		print('YES')
for i in range(int(input())):
	solve()


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
from bisect import bisect_left as lower_bound, bisect_right as upper_bound

def so():
	return int(input())

def st():
	return input()

def mj():
	return map(int, input().strip().split(' '))

def msj():
	return map(str, input().strip().split(' '))

def le():
	return list(map(int, input().split()))

def lebe():
	return list(map(int, input()))

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()

def joro(L):
	return ''.join(map(str, L))

def cheems(c, d):
	a = 1
	while d != 0:
		if d % 2 == 1:
			a *= c
		c = c * c
		d = d // 2
	return a

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def npr(n, r):
	return factorial(n) // factorial(n - r) if n >= r else 0

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r)) if n >= r else 0

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def tir(a, b, c):
	if 0 == c:
		return 1
	if len(a) <= b:
		return 0
	if c != -1:
		return tir(a, 1 + b, c + a[b]) or tir(a, b + 1, c - a[b]) or tir(a, 1 + b, c)
	else:
		return tir(a, 1 + b, a[b]) or tir(a, b + 1, -a[b]) or tir(a, 1 + b, -1)

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = -1
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = mid
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def wubu(m):
	import math as my
	d = 0
	while not m % 2:
		m = m // 2
		d = 1 + d
	for i in range(3, int(my.sqrt(m)) + 1, 2):
		while not m % i:
			m = m // i
			d = 1 + d
	return int(m > 1) + d

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	li = []
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, len(prime)):
		if prime[p]:
			li.append(p)
	return li

def primefactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n //= 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n //= i
	if n > 2:
		factors.append(n)
	return factors

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def tr(n):
	return n * (n + 1) // 2

def bro(q, r, c):
	(bec, pot, h) = (0, 0, 0)
	ds = []
	bs = []
	es = []
	for i in range(c):
		while h < len(r) and r[h] <= q[i][0]:
			pot = 0
			ds.clear()
			bs.clear()
			h = 1 + h
	for i in range(c):
		ds.append(q[i][1])
		es.append(q[i][1])
	ds = list(set(ds))
	for i in ds:
		bs.append(es.count(i))
	print(bs)
	for i in range(c):
		if q[i][0] > r[h - 1]:
			bec = bec + pot - bs[i]
			pot = 1 + pot
	return bec

def iu():
	import sys
	input = sys.stdin.readline
	import math as my
	(p, q, r, s) = mj()
	z = p + r + q - 3
	if q > p:
		(p, q) = (q, p)
	if r > p:
		(r, p) = (p, r)
	zo = p - 1 - r - q
	if s >= zo and s <= z:
		print('YES')
	else:
		print('NO')

def main():
	for i in range(so()):
		iu()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


ans = ['NO', 'YES']

def solve():
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	return ans[max(c - a - b, 0) - 1 <= m <= a + b + c - 3]
import sys
input = lambda : sys.stdin.readline().rstrip()
t = int(input())
for i in range(t):
	print(solve())


import math
import heapq
import string
from collections import deque
from bisect import bisect, bisect_left, bisect_right, insort
import sys
input = sys.stdin.readline
S = lambda : input().rstrip()
I = lambda : int(S())
M = lambda : map(int, S().split())
L = lambda : list(M())
H = 1000000000 + 7
for _ in range(I()):
	(a, b, c, m) = M()
	if m > a + b + c - 3:
		print('NO')
		continue
	l = [a, b, c]
	l.sort()
	t = l[2] - l[1] - l[0]
	if t > 1 and m < t - 1:
		print('NO')
		continue
	print('YES')


testcases = int(input())
for i in range(testcases):
	(a, b, c, m) = map(int, input().split())
	min_pair = 0
	max_pair = a + b + c - 3
	z = max(a, b, c)
	if z == a:
		min_pair = a - (b + c + 1)
	elif z == b:
		min_pair = b - (a + c + 1)
	elif z == c:
		min_pair = c - (a + b + 1)
	if m in range(min_pair, max_pair + 1):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, m) = [int(x) for x in input().split()]
	(a, b, c) = list(sorted([a, b, c]))
	min_pairs = max(0, c - a - b - 1)
	max_pairs = a - 1 + b - 1 + c - 1
	if m >= min_pairs and m <= max_pairs:
		print('YES')
	else:
		print('NO')


for __ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	n = a + b + c
	k1 = max(a, b, c)
	k2 = n - k1
	k = k1 - k2 - 1
	if m > n - 3 or m < k:
		print('NO')
	else:
		print('YES')


import sys
import math
from collections import deque, Counter
from sys import stdin
int1 = lambda x: int(x) - 1
stinput = lambda : stdin.readline()[:-1]
ii = lambda : int(stinput())
mi = lambda : map(int, stdin.readline().split())
li = lambda : list(mi())
mi1 = lambda : map(int1, stdin.readline().split())
li1 = lambda : list(mi1())
mis = lambda : map(str, stdin.readline().split())
pr = print
rg = range
from collections import defaultdict
mod = 10 ** 9 + 7
Mod = 998244353
INF = 10 ** 18
ans = 0
t = ii()
for _ in range(t):
	(a, b, c, m) = mi()
	x = [a, b, c]
	x.sort()
	if max(0, x[2] - x[1] - x[0] - 1) <= m <= sum(x) - 3:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	ans = [a, b, c]
	ans.sort()
	maxm = a - 1 + b - 1 + c - 1
	minm = ans[-1] - 1 - (ans[0] + ans[1])
	if minm <= m <= maxm:
		print('YES')
	else:
		print('NO')


import math
for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	ans = a - 1 + b - 1 + c - 1
	l = [a, b, c]
	l.sort()
	if ans >= m and l[2] - 1 - (l[1] + l[0]) <= m:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
from math import log2, ceil
for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = (max(a, b, c), a + b + c - max(a, b, c) - min(a, b, c), min(a, b, c))
	if m > a + b + c - 3 or a > b + c + m + 1:
		print('NO')
	else:
		print('YES')


import sys
input = sys.stdin.readline

def prb():
	l = list(map(int, input().split()))
	m = l[3]
	l.remove(l[3])
	l.sort()
	a = l[0]
	b = l[1]
	c = l[2]
	if a + b + c - 3 < m or c - (m + 1) > b + a:
		return 'NO'
	return 'YES'
for _ in range(int(input())):
	print(prb())


q = int(input())
result = []
for i in range(q):
	str = input()
	arr = str.split(' ')
	arr = [int(x) for x in arr]
	m = arr[3]
	arr.pop()
	arr.sort()
	(a, b, c) = arr
	if c - 1 - a - b <= m <= a + b + c - 3:
		result.append('YES')
	else:
		result.append('NO')
for x in result:
	print(x)


import sys
input = iter(sys.stdin.read().splitlines()).__next__

def solve(a, b, c, m):
	(a, b, c) = sorted([a, b, c])
	max_matches = c - 1 + b - 1 + a - 1
	min_matches = c - 1 - a - b
	return min_matches <= m <= max_matches
TC = int(input())
for tc in range(TC):
	(a, b, c, m) = map(int, input().split())
	res = solve(a, b, c, m)
	print('YES' if res else 'NO')


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	(c, b, a) = sorted([a, b, c])
	a -= 1
	b -= 1
	c -= 1
	if a - b >= m:
		a -= m
		m = 0
	else:
		m -= a - b
		a = b
		if (a - c) * 2 >= m:
			a -= m // 2
			b -= m // 2 + m % 2
			m = 0
		else:
			m -= (a - c) * 2
			a = c
			b = c
			if a + b + c >= m:
				now = m // 3
				a -= now
				m -= now
				now = m // 2
				b -= now
				m -= now
				now = m
				c -= now
				m -= now
	li = [a, b, c]
	li = sorted(li)
	if m > 0:
		print('NO')
	elif li[0] + li[1] + 2 >= li[2]:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	l = [a, b, c]
	l.sort()
	if m <= sum(l) - 3 and m >= max(0, l[2] - l[0] - l[1] - 1):
		print('YES')
	else:
		print('NO')


import sys
from math import *

def main():
	T = int(input())
	for _ in range(T):
		(a, b, c, m) = map(int, input().split())
		u = max(a, b, c)
		v = min(a, b, c)
		b = a + b + c - u - v
		a = u
		c = v
		maxi = a + b + c - 3
		mini = max(0, a - (b + c + 1))
		if mini <= m and m <= maxi:
			print('YES')
		else:
			print('NO')
main()


t = int(input())
for _ in range(t):
	(a, b, c, m) = map(int, input().split())
	max_m = a + b + c - 3
	min_m = max(max(a, b, c) - (a + b + c + 1 - max(a, b, c)), 0)
	if min_m <= m and m <= max_m:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	ar = [a, b, c]
	ar.sort()
	if m > a + b + c - 3:
		print('no')
	elif m >= ar[2] - (ar[0] + ar[1] + 1):
		print('yes')
	else:
		print('no')


from collections import Counter, defaultdict
from sys import stdin, stdout
import io, os, sys
input = stdin.readline
from collections import OrderedDict
mod = 998244353

def mapinput():
	return map(int, input().split())

def listinput():
	return list(map(int, input().split()))

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

def strinput():
	return input().strip()

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	ans = []
	for p in range(n + 1):
		if prime[p]:
			ans.append(p)
	return ans

def writ(ss):
	stdout.write(str(ss) + '\n')

def mult(a, b, mod):
	return a % mod * (b % mod) % mod
for test in range(intinput()):

	def solve():
		(a, b, c, m) = mapinput()
		maxi = a - 1 + (b - 1) + (c - 1)
		mini = max(a, b, c)
		left = a + b + c - mini
		mini1 = mini - left - 1
		mini2 = left - 1 + (mini - 2 * (left - 1)) - 2
		minimain = min(mini1, mini2)
		if minimain <= m <= maxi:
			print('YES')
		else:
			print('NO')
	solve()


n = int(input())
cases = []
for i in range(n):
	cases.append([int(i) for i in input().split()])
for i in range(len(cases)):
	(a, b, c, m) = (cases[i][0], cases[i][1], cases[i][2], cases[i][3])
	(a, b, c) = sorted([a, b, c])
	if c - 1 - (a + b) <= m <= a - 1 + (b - 1) + (c - 1):
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	tot = a + b + c
	max_pos_comb = max(0, a - 1) + max(0, b - 1) + max(0, c - 1)
	arr = [a, b, c]
	arr = sorted(arr)
	x = sum(arr) - arr[2]
	min_pos_comb = sum(arr) - 1 - 2 * x
	if m >= min_pos_comb and m <= max_pos_comb:
		print('YES')
	else:
		print('NO')


import sys
testcases = int(input())
while testcases > 0:
	(a, b, c, m) = map(int, sys.stdin.readline().split())
	maxi = a + b + c - 3
	s = [a, b, c]
	g = sorted(s)
	mini = g[2] - g[1] - g[0] - 1
	if mini <= m <= maxi:
		print('Yes')
	else:
		print('No')
	testcases -= 1


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	(a, b, c, m) = map(int, input().split())
	MAX = a - 1 + b - 1 + c - 1
	X = sorted([a, b, c])
	(a, b, c) = X
	MIN = c - (b + a) - 1
	MIN = max(MIN, 0)
	if MIN <= m <= MAX:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(A, B, C, n) = map(int, input().split())
	(A, B, C) = sorted([A, B, C])
	print('YES' if C - (A + B + 1) <= n <= A + B + C - 3 else 'NO')


from typing import Counter
import sys
from collections import defaultdict as dd
from math import *

def vinp():
	return map(int, input().split())

def linp():
	return list(map(int, input().split()))

def sinp():
	return input()

def inp():
	return int(input())

def mod(f):
	return f % 1000000007

def pr(*x):
	print(*x)

def finp():
	f = open('input.txt', 'r')
	f = f.read().split('\n')
	return f

def finp():
	f = open('input.txt', 'r')
	f = f.read().split('\n')
	return f

def fout():
	return open('output.txt', 'w')

def fpr(f, x):
	f.write(x + '\n')

def csort(c):
	sorted(c.items(), key=lambda pair: pair[1], reverse=True)

def indc(l, n):
	c = {}
	for i in range(n):
		c[l[i]] = c.get(l[i], []) + [i + 1]
	return c
cou = inp()
for i in range(cou):
	(a, b, c, m) = vinp()
	l = [a, b, c]
	l.sort()
	z = a + b + c - 3
	if m > z:
		pr('NO')
	elif m >= l[2] - (l[0] + l[1] + 1):
		pr('YES')
	else:
		pr('NO')


t = int(input())
for _ in range(t):
	s = input()
	arr = [int(v) for v in s.split(' ')]
	m = arr[-1]
	arr = arr[:-1]
	arr.sort()
	mx = sum(arr) - 3
	mn = arr[2] - arr[0] - arr[1] - 1
	if mn <= m <= mx:
		print('YES')
	else:
		print('NO')


import sys
import getpass
import math, random
import functools, itertools, collections, heapq, bisect
from collections import Counter, defaultdict, deque
input = sys.stdin.readline
M9 = 10 ** 9 + 7
(yes, no) = ('YES', 'NO')
MAXINT = sys.maxsize
OFFLINE_TEST = getpass.getuser() == 'hkmac'

def log(*args):
	if OFFLINE_TEST:
		print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)

def solve(*args):
	if OFFLINE_TEST:
		log('----- solving ------')
		log(*args)
		log('----- ------- ------')
	return solve_(*args)

def read_matrix(rows):
	return [list(map(int, input().split())) for _ in range(rows)]

def read_strings(rows):
	return [input().strip() for _ in range(rows)]

def minus_one(arr):
	return [x - 1 for x in arr]

def minus_one_matrix(mrr):
	return [[x - 1 for x in row] for row in mrr]

def solve_(a, b, c, m):
	(a, b, c) = sorted([a, b, c])
	upper = max(0, a - 1) + max(0, b - 1) + max(0, c - 1)
	log(upper)
	if m > upper:
		return no
	lower = c - a - b - 1
	lower = max(lower, 0)
	log(lower)
	if m < lower:
		return no
	return yes
for case_num in range(int(input())):
	(a, b, c, m) = list(map(int, input().split()))
	res = solve(a, b, c, m)
	print(res)


t = int(input())
for i in range(t):
	(a, b, c, m) = list(map(int, input().split()))
	max_ = a + b + c - 3
	min_ = max([a, b, c]) - 1 - (sum([a, b, c]) - max([a, b, c]))
	if min_ <= m <= max_:
		print('YES')
	else:
		print('NO')


T = int(input())
for t in range(T):
	(a, b, c, m) = map(int, input().split())
	most_pair = a + b + c - 3
	data = [a, b, c]
	data = sorted(data)
	min_data = data[0]
	mid_data = data[1]
	max_data = data[2]
	least_pair = max_data - mid_data - min_data - 1
	if most_pair >= m and least_pair <= m:
		print('YES')
	else:
		print('NO')


def mini(a, b, c):
	if b + c < a - 1:
		return a - b - c - 1
	elif a + c < b - 1:
		return b - a - c - 1
	elif a + b < c - 1:
		return c - a - b - 1
	return 0
for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	if mini(a, b, c) <= m <= a + b + c - 3:
		print('YES')
	else:
		print('NO')


def main():
	n = int(input())
	array = []
	for i in range(n):
		array.append(map(lambda x: int(x), input().split()))
	for i in range(n):
		(a, b, c, m) = array[i]
		if a - 1 + (b - 1) + (c - 1) < m:
			print('NO')
			continue
		elif a > b + c:
			if abs(b + c - a) - 1 > m:
				print('NO')
				continue
		elif b > a + c and abs(a + c - b) - 1 > m:
			print('NO')
			continue
		elif c > b + a and abs(a + b - c) - 1 > m:
			print('NO')
			continue
		print('YES')
main()


import sys
input = sys.stdin.buffer.readline
for t in range(int(input())):
	(A, B, C, M) = map(int, input().split())
	X = [A, B, C]
	X.sort()
	(A, B, C) = (X[0], X[1], X[2])
	if A + B + 1 < C:
		D = C - (A + B + 1)
		C -= D
		M -= D
	if 0 <= M and M <= A + B + C - 3:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	print('YES' if c - (a + b + 1) <= m <= a + b + c - 3 else 'NO')


t = int(input())
for case in range(t):
	(a, b, c, m) = map(int, input().split())
	arr = [a, b, c]
	arr.sort()
	maxi = a + b + c - 3
	mini = arr[2] - arr[1] - arr[0] - 1
	if mini <= m <= maxi:
		print('YES')
	else:
		print('NO')


t = int(input())
for q in range(t):
	abcm = [int(x) for x in input().split()]
	a = int(abcm[0])
	b = int(abcm[1])
	c = int(abcm[2])
	m = int(abcm[3])
	arr = [a, b, c]
	arr.sort()
	if m <= a + b + c - 3 and m >= arr[2] - 2 * arr[0] - (arr[1] - arr[0]) - 1:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def input_list():
	return list(map(int, input().split()))

def input_string():
	s = input()
	return list(s[:len(s) - 1])

def input_int_gen():
	return map(int, input().split())
mem = [0]

def xors(n):
	if len(mem) > n:
		return mem[n]
	else:
		for i in range(len(mem), n + 1):
			mem.append(mem[-1] ^ i)
		return mem[n]
tests = inp()
for _ in range(tests):
	(a, b, c, m) = input_int_gen()
	maxi = max(a, b, c)
	cut = a + b + c - maxi
	pairs = a + b + c - 3
	mini = max(maxi - 1 - cut, 0)
	print('YES' if pairs >= m >= mini else 'NO')


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify
mod = 10 ** 9 + 7
INF = float('inf')

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

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))

def inps():
	return sys.stdin.readline()

def inpsl(x):
	tmp = sys.stdin.readline()
	return list(tmp[:x])

def err(x):
	print(x)
	exit()
for _ in range(inp()):
	(a, b, c, m) = inpl()
	abcs = [a, b, c]
	abcs.sort()
	mi = max(abcs[2] - 1 - (abcs[0] + abcs[1]), 0)
	mx = sum(abcs) - 3
	print('YES' if mi <= m <= mx else 'NO')


import sys
input = sys.stdin.readline
for i in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	Min = max(c - (a + b + 1), 0)
	Max = sum((max(i - 1, 0) for i in (a, b, c)))
	if Min <= m <= Max:
		print('YES')
	else:
		print('NO')


t = int(input())
while t > 0:
	(a, b, c, m) = map(int, input().strip().split())
	ma = a + b + c - 3
	ans = []
	ans.append(a)
	ans.append(b)
	ans.append(c)
	ans.sort()
	mi = ans[-1] - ans[-2] - ans[-3] - 1
	if m >= mi and m <= ma:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
while t:
	t -= 1
	(a, b, c, m) = map(int, input().split())
	Q = [a, b, c]
	if m > a + b + c - 3 or m < max(Q) - (sum(Q) - max(Q)) - 1:
		print('NO')
	else:
		print('YES')


INF = 10 ** 18
import sys
import pprint
import logging
from logging import getLogger
import array

def input():
	return sys.stdin.readline().rstrip('\r\n')

def maps():
	return [int(i) for i in input().split()]
logging.basicConfig(format='%(message)s', level=logging.WARNING)
logger = getLogger(__name__)
logger.setLevel(logging.INFO)

def debug(msg, *args):
	logger.info(f'{msg}={pprint.pformat(args)}')
for i in range(*maps()):
	(a, b, c, m) = maps()
	k = max(a, max(b, c))
	if k == a:
		k = k - (c + b)
	elif k == b:
		k = k - (a + c)
	else:
		k = k - (a + b)
	a = a - 1
	b -= 1
	c -= 1
	k -= 1
	if a + b + c >= m and k <= m:
		print('YES')
	else:
		print('NO')


def sol(a, b, c, m):
	s = sorted([a, b, c])
	left = s[2] - (s[1] + s[0]) - 1
	right = 0
	for i in s:
		if i:
			right += i - 1
	if m <= right and m >= left:
		return 'Yes'
	return 'No'
t = int(input())
for _ in range(t):
	(a, b, c, m) = map(int, input().split())
	print(sol(a, b, c, m))


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
import math as mt
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
mod = int(1000000000.0) + 7

def power(k, n):
	if n == 0:
		return 1
	if n % 2:
		return power(k, n - 1) * k % mod
	t = power(k, n // 2)
	return t * t % mod

def totalPrimeFactors(n):
	count = 0
	if n % 2 == 0:
		count += 1
		while n % 2 == 0:
			n //= 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			count += 1
			while n % i == 0:
				n //= i
		i += 2
	if n > 2:
		count += 1
	return count

def main():
	for _ in range(int(input())):
		(a, b, c, m) = map(int, input().split())
		t = [a, b, c]
		t.sort()
		if t[-1] >= m + 1:
			if 2 * t[-1] <= sum(t) + m + 1:
				print('Yes')
			else:
				print('No')
		else:
			for i in range(2, -1, -1):
				k = min(t[i] - 1, m)
				m -= k
				t[i] -= k + 1
			if m:
				print('No')
			else:
				print('Yes')
	return
main()


import sys

def get_ints():
	return list(map(int, sys.stdin.readline().strip().split()))
(t,) = get_ints()
while t > 0:
	(a, b, c, m) = get_ints()
	if b < c:
		(b, c) = (c, b)
	if a < b:
		(a, b) = (b, a)
	if b < c:
		(b, c) = (c, b)
	t -= 1
	if a - b - c - 1 <= m and m <= max(a - 1, 0) + max(b - 1, 0) + max(c - 1, 0):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def solve():
	(a, b, c, m) = map(int, input().split())
	if m > a - 1 + b - 1 + c - 1:
		print('NO')
		return
	if a > b:
		(a, b) = (b, a)
	if a > c:
		(a, c) = (c, a)
	if b > c:
		(b, c) = (c, b)
	if a + b < c + 1:
		e = c - a - b - 1
	else:
		e = 0
	if m < e:
		print('NO')
	else:
		print('YES')
for i in range(int(input())):
	solve()


T = int(input())

def solve():
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	if c == 0:
		print('YES' if m == 0 else 'NO')
		return
	if b == 0:
		print('YES' if m == c - 1 else 'NO')
		return
	v = a + b + c - 3
	s = max(c - a - b, 0)
	if s >= 2:
		print('YES' if s - 1 <= m <= v else 'NO')
	else:
		print('YES' if m <= v else 'NO')
for _ in range(T):
	solve()


t = int(input())
for i in range(t):
	(a, b, c, m) = map(int, input().split())
	pmax = a + b + c - 3
	(a, b, c) = sorted([a, b, c])
	pmin = c - (a + b + 1)
	if m >= pmin and m <= pmax:
		print('YES')
	else:
		print('NO')


n = int(input())
for _ in range(n):
	(a, b, c, m) = list(map(int, input().split()))
	if a + b + c - 3 >= m >= max(a, b, c) - (a + b + c + 1 - max(a, b, c)):
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b, c, m) = map(int, input().split())
	maxi = a + b + c - 3
	mini = 2 * max(a, b, c) - 1 - (a + b + c)
	if mini <= m <= maxi:
		print('YES')
	else:
		print('NO')


test = int(input())
for _ in range(test):
	(l, m, n, o) = map(int, input().split())
	len = [l, m, n]
	len.sort()
	loweruu = len[2]
	loweruu -= len[1]
	loweruu -= len[0]
	loweruu -= 1
	higheruu = len[0] - 1
	higheruu += len[1] - 1
	higheruu += len[2] - 1
	if o >= loweruu and o <= higheruu:
		print('YES')
	else:
		print('NO')


from sys import stdin
from sys import stdout

def get():
	return stdin.readline().strip()

def getf(sp=' '):
	return [int(i) for i in get().split(sp)]

def put(a, end='\n'):
	stdout.write(str(a) + end)

def putf(a, sep=' ', end='\n'):
	stdout.write(sep.join([str(i) for i in a]) + end)

def f(a, b):
	return max(0, abs(a - b) - 1)

def solve(a, b, c, m):
	(c, b, a) = sorted([a, b, c])
	q = max(0, a - 1 - (b + c))
	if q > m:
		return 'NO'
	if a + b + c - 3 >= m:
		return 'YES'
	return 'NO'

def main():
	for _ in range(int(get())):
		(a, b, c, m) = getf()
		put(solve(a, b, c, m))
main()


T = int(input())
for _ in range(T):
	(A, B, C, M) = map(int, input().split())
	(A, B, C) = sorted((A, B, C))
	if M >= A + B + C - 2:
		ans = 'NO'
	elif A + B >= C - 1:
		ans = 'YES'
	elif M >= C - A - B - 1:
		ans = 'YES'
	else:
		ans = 'NO'
	print(ans)


from sys import stdin
for _ in range(int(stdin.readline())):
	(a, b, c, m) = list(map(int, stdin.readline().split()))
	if a + b + c - 3 < m:
		print('NO')
		continue
	(a, b, c) = sorted([a, b, c])
	if c - 1 - (b + a) > m:
		print('NO')
		continue
	print('YES')


import sys
import math
import heapq
from collections import defaultdict as dd
from collections import OrderedDict as od
from collections import deque
from itertools import permutations as pp
from itertools import combinations as cc
from sys import stdin
from functools import cmp_to_key as ctk
from functools import lru_cache
from bisect import bisect_left as bs_l
from bisect import bisect_right as bs_r
input = sys.stdin.readline
mod = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 5)

def comparator(x, y):
	if x[0] == y[0]:
		return y[1] - x[1]
	return True

def ncr(n, r):
	if n < r:
		return 0
	return fc[n] * pow(fc[r] * fc[n - r] % mod, mod - 2, mod) % mod
T = int(input())
for _ in range(T):
	(a, b, c, m) = map(int, input().split())
	ll = [a, b, c]
	ll.sort()
	(x, y, z) = (ll[0], ll[1], ll[2])
	mn = max(ll[2] - ll[1] - ll[0] - 1, 0)
	mx = a + b + c - 3
	if mn <= m <= mx:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
t = int(input())
inf = pow(10, 9) + 7
for _ in range(t):
	(a, b, c, m) = map(int, input().split())
	s = a + b + c
	if s <= m:
		ans = 'NO'
		print(ans)
		continue
	m0 = max(a, b, c)
	mi = max(0, m0 - (s - m0) - 1)
	ma = a - 1 + (b - 1) + (c - 1)
	ans = 'YES' if mi <= m <= ma else 'NO'
	print(ans)


def exists_string(nums, m):
	nums.sort()
	diff = nums[2] - nums[1] - nums[0]
	mini = diff - 1
	if diff <= 1:
		mini = 0
	maxi = nums[2] + nums[1] + nums[0] - 3
	if m >= mini and m <= maxi:
		return 'YES'
	else:
		return 'NO'
iterations = int(input())
for i in range(0, iterations):
	nums = input().split(' ')
	nums = [int(x) for x in nums]
	m = nums[3]
	print(exists_string(nums[:3], m))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
from math import ceil, floor, sqrt, log2, gcd, pi
from heapq import heappush, heappop
from bisect import bisect_left, bisect
from functools import reduce
import sys
abc = 'abcdefghijklmnopqrstuvwxyz'
ABC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	arr = [a, b, c]
	arr.sort()
	req = 0
	req = arr[-1] - arr[1] - arr[0] - 1
	tot = a + b + c
	maxi = max(a - 1, 0) + max(b - 1, 0) + max(c - 1, 0)
	if maxi < m:
		print('NO')
	elif req > m:
		print('NO')
	else:
		print('YES')


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	maxi = a - 1 + (b - 1) + (c - 1)
	if maxi <= 0 and m >= 1:
		print('NO')
		continue
	z = max(a, b, c)
	if z > a + b + c + 1 - z + m:
		print('NO')
		continue
	if m >= 0 and m <= maxi:
		print('YES')
	else:
		print('NO')


import sys
from sys import stdin
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, namedtuple
from math import gcd, ceil, floor
from itertools import combinations, permutations

def main():
	test = int(input())
	for idt in range(test):
		(a, b, c, m) = map(int, input().split())
		ca = a - 1
		cb = b - 1
		cc = c - 1
		if ca + cb + cc < m:
			print('NO')
			continue
		if ca + cb + cc == m:
			print('YES')
			continue
		nums = [a, b, c]
		nums.sort(reverse=True)
		if nums[0] >= nums[1] + nums[2]:
			nums[0] -= nums[1] + nums[2]
			if nums[0] - 1 > m:
				print('NO')
			else:
				print('YES')
		else:
			print('YES')
	return
main()


import math
for i in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	if c - (a + b + 1) <= m and a + b + c - 3 >= m:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	print('Yes' if m <= a + b + c - 3 and m >= 2 * max(a, b, c) - a - b - c - 1 else 'No')


t = int(input())
for _ in range(t):
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = (max(a, b, c), a + b + c - max(a, b, c) - min(a, b, c), min(a, b, c))
	if a <= (a + b + c + 1) // 2:
		l = 0
	else:
		l = (a - (a + b + c + 1) // 2) * 2
		if (a + b + c) % 2 == 0:
			l -= 1
	r = a + b + c - 1
	if b > 0:
		r -= 1
	if c > 0:
		r -= 1
	if l <= m <= r:
		print('YES')
	else:
		print('NO')


def combination(a, b, c, m):
	if a + b + c - 3 < m:
		return False
	if m < a - b - c - 1 or m < b - a - c - 1 or m < c - a - b - 1:
		return False
	return True

def main():
	t = int(input())
	for i in range(t):
		inpt = input().split(' ')
		if combination(int(inpt[0]), int(inpt[1]), int(inpt[2]), int(inpt[3])):
			print('YES')
		else:
			print('NO')
main()


import sys
input = sys.stdin.readline
(T,) = map(int, input().split())
for _ in range(T):
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	if m > a + b + c - 3:
		print('NO')
		continue
	x = max(c - (a + b) - 1, 0)
	if m < x:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted((a, b, c))
	if m > a + b + c - 3 or m < max(0, c - (a + b + 1)):
		print('NO')
		continue
	else:
		print('YES')


for vbnm in range(int(input())):
	(a, b, c, m) = list(map(int, input().split()))
	x = [a, b, c]
	x.sort()
	a = x[0]
	b = x[1]
	c = x[2]
	max = a + b + c - 3
	ex = c - b - a - 1
	if m > max:
		print('no')
		continue
	rem = a + b + 1
	if ex <= 0:
		print('yes')
		continue
	tem = ex // rem
	min = rem * tem
	min += ex % rem
	if m >= min:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted([a, b, c])
	highest = a - 1 + (b - 1) + (c - 1)
	lowest = c - (a + b + 1)
	print('YES' if lowest <= m <= highest else 'NO')


t = int(input())
while t > 0:
	(a, b, c, m) = [int(x) for x in input().split()]
	if a > c:
		(a, c) = (c, a)
	if b > c:
		(b, c) = (c, b)
	s = a - 1 + (b - 1) + (c - 1)
	if c - (a + b + 1) <= m <= s:
		print('YES')
	else:
		print('NO')
	t -= 1


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def input_list():
	return list(map(int, input().split()))

def input_string():
	s = input()
	return list(s[:len(s) - 1])

def input_int_gen():
	return map(int, input().split())
tests = inp()
for _ in range(tests):
	lst = input_list()
	m = lst[3]
	lst = sorted(lst[:3])
	(c, b, a) = (lst[0], lst[1], lst[2])
	maxp = a - 1 + (b - 1) + (c - 1)
	if m > maxp:
		print('NO')
		continue
	if a <= b + c + 1:
		print('YES')
		continue
	elif m < a - b - c - 1:
		print('NO')
		continue
	print('YES')


for _ in range(int(input())):
	(a, b, c, m) = map(int, input().split())
	(a, b, c) = sorted((a, b, c))
	trans = min(c - b, m)
	c -= trans
	m -= trans
	if m > 0:
		trans = min((b - a) * 2, m)
		m -= trans
		b -= (trans + 1) // 2
		c -= trans // 2
		if m > 0:
			trans = min(a + b + c, m)
			m -= trans
			a -= (trans + 2) // 3
			b -= (trans + 1) // 3
			c -= trans // 3
	if a == 0 or a + b + 1 < c or m > 0:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(*nums, m) = map(int, input().split())
	if sum(nums) - 3 < m:
		print('NO')
	elif sum(nums) - max(nums) + 1 + m >= max(nums):
		print('YES')
	else:
		print('NO')


def main():
	(a, b, c, m) = map(int, input().split())
	el = [a, b, c]
	el = sorted(el, reverse=True)
	diff = el[0] - el[1] - el[2]
	p = diff - 1 if diff > 1 else 0
	if p > m:
		print('NO')
		return
	pairs = 0
	for i in (a, b, c):
		if i > 1:
			pairs += i - 1
	print('YES') if pairs >= m else print('NO')
t = int(input())
while t > 0:
	t -= 1
	main()


try:
	import sys
	from functools import lru_cache, cmp_to_key
	from heapq import merge, heapify, heappop, heappush
	from math import *
	from collections import defaultdict as dd, deque, Counter as C
	from itertools import combinations as comb, permutations as perm
	from bisect import bisect_left as bl, bisect_right as br, bisect, insort
	from time import perf_counter
	from fractions import Fraction
	import copy
	from copy import deepcopy
	import time
	starttime = time.time()
	mod = int(pow(10, 9) + 7)
	mod2 = 998244353

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

	def out(*var, end='\n'):
		sys.stdout.write(' '.join(map(str, var)) + end)

	def L():
		return list(sp())

	def sl():
		return list(ssp())

	def sp():
		return map(int, data().split())

	def ssp():
		return map(str, data().split())

	def l1d(n, val=0):
		return [val for i in range(n)]

	def l2d(n, m, val=0):
		return [l1d(n, val) for j in range(m)]

	def A2(n, m):
		return [[0] * m for i in range(n)]

	def A(n):
		return [0] * n
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
for _ in range(L()[0]):
	(a, b, c, m) = L()
	(a, b, c) = sorted([a, b, c])
	mn = max(0, c - (a + b + 1))
	mx = a + b + c - 3
	if not mn <= m <= mx:
		print('NO')
	else:
		print('YES')


tc = int(input())
for _ in range(tc):
	(a, b, c, m) = list(map(int, input().split()))
	l = [a, b, c]
	l.sort()
	minval = l[2] - l[1] - l[0] - 1
	maxval = a + b + c - 3
	if m > maxval:
		print('NO')
	elif m == maxval:
		print('YES')
	elif m >= minval:
		print('YES')
	else:
		print('NO')