t = int(input())
while t:
    z = input()
    le = len(z)-1
    l = []
    for i in range(le):
        l.append(z[i] + "0"*(le-i))
    for a in l:
        if int(a)!=0:
            print(a, end=" ")
    if int(z[-1]):
        print(z[-1])
    t-=1


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
    for _ in range(t):
        kap=int(input())
        res=[]
        while kap!=0:
            lenk=len(str(kap))
            dd=kap//(10**(lenk-1))
            res.append(10**(lenk-1)*dd)
            kap=kap%(10**(lenk-1))
        print(len(res))
        yield " ".join(str(x) for x  in res)
if __name__ == '__main__':
    t= int(input())
    ans = gift()
    print(*ans,sep='\n')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
    for _ in range(t):
        kap=int(input())
        res=[]
        while kap!=0:
            lenk=len(str(kap))
            dd=kap//(10**(lenk-1))
            res.append(10**(lenk-1)*dd)
            kap=kap%(10**(lenk-1))
        yield " ".join(str(x) for x  in res)
if __name__ == '__main__':
    t= int(input())
    ans = gift()
    print(*ans,sep='\n')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
    for _ in range(t):
        kap=int(input())
        res=[]
        while kap!=0:
            lenk=len(str(kap))
            dd=kap//(10**(lenk-1))
            res.append(10**(lenk-1)*dd)
            kap=kap%(10**(lenk-1))
        yield(len(res))
        yield " ".join(str(x) for x  in res)
if __name__ == '__main__':
    t= int(input())
    ans = gift()
    print(*ans,sep='\n')


t = int(input())
for i in range(t):
    n = int(input())
    power = 1
    while n > 0:
        to_print = int(n % 10) * power
        if to_print != 0:
            print(to_print)
        power *= 10
        n = int(n/10)


t = int(input())
for i in range(t):
    n = int(input())
    cn = n
    cnt = 0
    while cn > 0:
        if int(cn % 10) != 0:
            cnt = cnt + 1
        cn = int(cn/10)
    print(cnt)
    power = 1
    while n > 0:
        to_print = int(n % 10) * power
        if to_print != 0:
            print(to_print)
        power *= 10
        n = int(n/10)


for t in range(int(input())):
    n = input()
    numbers = []
    cont = 0
    for x in reversed(n):
        numbers.append(x + (cont * "0"))
        cont += 1
    print(cont)
    numbers2 = ""
    for x in reversed(numbers):
        numbers2 = numbers2 + x + " "
    print(numbers2)


for t in range(int(input())):
    n = input()
    numbers = []
    cont = 0
    if int(n) % 10 != 0:
        for x in reversed(n):
            if x != "0":
                numbers.append(x + (cont * "0"))
                cont += 1
            else:
                cont += 1
    else:
        numbers.append(n)
        cont += 1
    print(cont)
    numbers2 = ""
    for x in reversed(numbers):
        numbers2 = numbers2 + x + " "
    print(numbers2)


for t in range(int(input())):
    n = input()
    numbers = []
    cont = 0
    cont2 = 0
    if int(n) % 10 != 0:
        for x in reversed(n):
            if x != "0":
                numbers.append(x + (cont * "0"))
                cont2 += 1
                cont += 1
            else:
                cont += 1
    else:
        numbers.append(n)
        cont2 += 1
    print(cont2)
    numbers2 = ""
    for x in reversed(numbers):
        numbers2 = numbers2 + x + " "
    print(numbers2)


for t in range(int(input())):
    n = input()
    numbers = []
    cont = 0
    if int(n) % 10 != 0:
        for x in reversed(n):
            numbers.append(x + (cont * "0"))
            cont += 1
    else:
        numbers.append(n)
        cont += 1
    print(cont)
    numbers2 = ""
    for x in reversed(numbers):
        numbers2 = numbers2 + x + " "
    print(numbers2)


for t in range(int(input())):
    n = input()
    numbers = []
    cont = 0
    cont2 = 0
    for x in reversed(n):
        if x != "0":
            numbers.append(x + (cont * "0"))
            cont2 += 1
            cont += 1
        else:
            cont += 1
    print(cont2)
    numbers2 = ""
    for x in reversed(numbers):
        numbers2 = numbers2 + x + " "
    print(numbers2)


#Sum_of_Round_Numbers
testCases=int(input())
res=[]
while testCases:
    s = input()
    counter = 0
    ans=[]
    a={}
    for i in range(1, len(s)):
        if int(s[i]) > 0:
            counter += 1
            x = s[i]
            for i in range(len(s)-i-1):
                x += '0'
            ans.append(int(x))
    a[counter]=ans
    res.append(a)
    testCases -= 1

for i in res:
    for j in i:
        print(j)
        print(*i[j], sep=" ")


#Sum_of_Round_Numbers
testCases=int(input())
res=[]
while testCases:
    s = input()
    counter = 0
    ans=[]
    a={}
    for i in range(1, len(s)):
        if int(s[i]) > 0:
            counter += 1
            x = s[i]
            for i in range(len(s)-i-1):
                x += '0'
            ans.append(int(x))
    a[counter]=ans
    res.append(a)
    testCases -= 1

for i in res:
    for j in i:
        print(j)
        print(i[j])


#Sum_of_Round_Numbers
testCases=int(input())
res=[]
while testCases:
    s = input()
    counter = 0
    ans=[]
    a={}
    for i in range(0, len(s)):
        if int(s[i]) > 0:
            counter += 1
            x = s[i]
            for i in range(len(s)-i-1):
                x += '0'
            ans.append(int(x))
    a[counter]=ans
    res.append(a)
    testCases -= 1

for i in res:
    for j in i:
        print(j)
        print(*i[j], sep=" ")


for i in range(int(input())):

    a=list(input())

    t=[]

    for j  in a[::-1]:
        if j!='0':
            t.append(int(j+'0'*(len(a)-1-a.index(j))))

    t.sort()
    print(len(t))
    print(*t)


for k in range(int(input())):
    a = input()[::-1]

    f=[]

    for  j in range(len(a)):
        if a[j]!='0':
            f.append(int(a[j]+'0'*(j)))

    print(len(f))
    print(*f)


for i in range(int(input())):
	n=int(input())
	l=[]
	for i in range(1,len(str(n))+1):
		if n<10:
			l.append(n)
		else:
			if str(n).count("0")==len(str(n))-1:
				l.append(n)
				break
			else:
				a=n%(10**i)
				if a>0:
					l.append(a)
					n-=a
	print(len(l))
	print(" ".join(map(str,l)))


for i in range(int(input())):
	n=int(input())
	l=[]
	for i in range(1,len(str(n))+1):
		if n<10:
			l.append(n)
		else:
			if str(n).count("0")==len(str(n))-1:
				l.append(n)
				break
			else:
				a=n%(10**i)
				l.append(a)
				n-=a
	print(len(l))
	print(" ".join(map(str,l)))


n=int(input())
l=[]
for i in range(1,len(str(n))+1):
	if n<10:
		l.append(n)
	else:
		if str(n).count("0")==len(str(n))-1:
			l.append(n)
			break
		else:
			a=n%(10**i)
			l.append(a)
			n-=a
print(len(l))
print(" ".join(map(str,l)))


t = int(input())
for t in range(0, t):
    n = list(input())
    n = [int(x) for x in n]
    l = len(n)
    x = ""
    for i in range(0, l):
        n[i] = n[i] * (10**(l-1-i))
        if n[i] != 0:
            x = x + str(n[i]) + " "
    print(x)


t = int(input())
for t in range(0, t):
    n = list(input())
    n = [int(x) for x in n]
    l = len(n)
    x = ""
    for i in range(0, l):
        n[i] = n[i] * (10**(l-1-i))
        if n[i] != 0:
            x = x + str(n[i]) + " "
    x = x.strip()
    print(x)


t = int(input())
for t in range(0, t):
    n = list(input())
    n = [int(x) for x in n]
    l = len(n)
    x = ""
    z = 0
    for i in range(0, l):
        n[i] = n[i] * (10**(l-1-i))
        if n[i] != 0:
            z = z + 1
            x = x + str(n[i]) + " "
    x = x.strip()
    print(z)
    print(x)


for t in range(int(input())):
    s = input()
    l = len(s)
    s = int(s)
    ans = [0]
    i = 10**(l-1)
    while i >= 1:
        if s % i != 0:
            ans.append(s-(s%i))
        else:
            ans.append(s)
        s = s % i
        i = i // 10
    ans = set(ans)
    ans.remove(0)
    print(*ans)


for t in range(int(input())):
    s = input()
    l = len(s)
    s = int(s)
    ans = [0]
    i = 10**(l-1)
    while i >= 1:
        if s % i != 0:
            ans.append(s-(s%i))
        else:
            ans.append(s)
        s = s % i
        i = i // 10
    ans = set(ans)
    ans.remove(0)
    print(len(ans))
    print(*ans)


import re
t=int(input())
for _ in range(t):
    n=input()
    if not re.search("[123456789]",n[1::]):
        print(1)
        print(n)
    else:
        ans=[]
        c=0
        k=len(n)
        for i in range(0,k):
            if not n[i] == '0':
                ans.append(n[i]+'0'*(k-i-1))
                c+=1
        print(c)
        print(' '.join(ans))


import re
t=int(input())
for _ in range(t):
    n=input()
    if not re.search("[123456789]",n[1::]):
        print(n)
    else:
        ans=[]
        c=0
        for i in range(len(n)-1,-1,-1):
            if not n[i] == '0':
                ans.append(n[i]+'0'*i)
                c+=1
        print(c)
        print(' '.join(ans))


import re
t=int(input())
for _ in range(t):
    n=input()
    if not re.search("[123456789]",n[1::]):
        print(1)
        print(n)
    else:
        ans=[]
        c=0
        for i in range(len(n)-1,-1,-1):
            if not n[i] == '0':
                ans.append(n[i]+'0'*i)
                c+=1
        print(c)
        print(' '.join(ans))


t = int(input())
for _ in range(t):
    arr = []
    num = input()
    for i in range(len(num)-1,-1,-1):
        if num[i] != '0':
            arr.append(int(num[i])*10**(len(num)-i-1))
    print(len(arr))
    for i in range(len(arr)):
        if i == len(arr)-1:
            print(arr[i])
        else:
            print(arr[i],end= ' ')


t = int(input())
for _ in range(t):
    arr = []
    num = input()
    for i in range(len(num)-1,-1,-1):
        if num[i] != '0':
            arr.append(int(num[i])*10**(len(num)-i-1))
    for i in arr:
        print(i,end = ' ')
    print()


t = int(input())
for _ in range(t):
    arr = []
    num = input()
    for i in range(len(num)-1,-1,-1):
        if num[i] != '0':
            arr.append(int(num[i])*10**(len(num)-i-1))
    for i in range(len(arr)):
        if i == len(arr)-1:
            print(arr[i])
        else:
            print(arr[i],end= ' ')


t = int(input())
nums = list(input().split())

for t in nums:
  res = []
  for i, n in enumerate(t[::-1]):
    if int(n) % 10 != 0:
      res.append(n + '0'*i)

  # res = list(map(int, res))
  print(len(res))
  print(*res)


t = int(input())
nums = list(input().split())

for t in nums:
  res = []
  for i, n in enumerate(t[::-1]):
    if int(n) % 10 != 0:
      res.append(n + '0'*i)

  print(len(res))
  print(' '.join(res))


t = int(input())
nums = list(input().split())

for t in nums:
  res = []
  for i, n in enumerate(t[::-1]):
    if int(n) % 10 != 0:
      res.append(n + '0'*i)

  res = list(map(int, res))
  print(len(res))
  print(' '.join(res))


t = int(input())
nums = []
for i in range(t):
  nums.append(input())

for t in nums:
  res = []
  for i, n in enumerate(t[::-1]):
    if int(n) % 10 != 0:
      res.append(n + '0'*i)

  # res = list(map(int, res))
  print(len(res))
  print(*res)


t=int(input())
for x in range(t):
    n=int(input())
    if(1<=n<=10):
        print("1")
        print(n)
    else:
        i=1
        a=[]
        while(n>0):
            rem=n%10**i
            if((rem==0 and (n/10**i)%10==0)or n<10**i):
                a.append(n)
                break
            else:
                n-=rem
                a.append(rem)
                i+=1
        c=a.count(0)
        for i in range(c):
            a.remove(0)
        print(len(a))
        print(*a)


t=int(input())
for x in range(t):
    n=int(input())
    if(1<=n<=10):
        print("1")
        print(n)
    else:
        i=1
        a=[]
        while(n>0):
            rem=n%10**i
            if((rem==0 and (n/10**i)%10**i+1==0)or n<10**i):
                a.append(n)
                break
            else:
                n-=rem
                a.append(rem)
                i+=1
        c=a.count(0)
        for i in range(c):
            a.remove(0)
        print(len(a))
        print(*a)


t=int(input())
for x in range(t):
    n=int(input())
    if(1<=n<=10):
        print("1")
        print(n)
    else:
        i=1
        a=[]
        while(n>0):
            rem=n%10**i
            if(rem==0 or n<10**i):
                a.append(n)
                break
            else:
                n-=rem
                a.append(rem)
                i+=1
        print(len(a))
        print(*a)


t=int(input())
for x in range(t):
    n=int(input())
    if(1<=n<=10):
        print("1")
        print(n)
    else:
        i=1
        a=[]
        while(n>0):
            rem=n%10**i
            if((rem==0 and (n/10**i)%10==0)or n<10**i):
                a.append(n)
                break
            else:
                n-=rem
                a.append(rem)
                i+=1
        if 0 in a:
            a.remove(0)
        print(len(a))
        print(*a)


import sys
def eprint(*args):
    print(*args, file=sys.stderr)
zz=1
from math import *
#sys.setrecursionlimit(10**6)
if zz:
	input=sys.stdin.readline
else:
	sys.stdin=open('input.txt', 'r')
	sys.stdout=open('all.txt','w')

t=int(input())
while t>0:
	t-=1
	n=int(input())
	if n%10==0 or len(str(n))==1:
		print(1)
		print(n)
	else:
		print(2)
		print(n//10,n%10)


import sys
def eprint(*args):
    print(*args, file=sys.stderr)
zz=1
from math import *
#sys.setrecursionlimit(10**6)
if zz:
	input=sys.stdin.readline
else:
	sys.stdin=open('input.txt', 'r')
	sys.stdout=open('all.txt','w')

t=int(input())
while t>0:
	t-=1
	n=int(input())
	print(len(str(n))-str(n).count('0'))
	s=str(n)
	for i in range(len(s)):
		if s[i]!='0':
			print(int(s[i])*10**(len(s)-i-1),end=" ")
	print()


import sys
def eprint(*args):
    print(*args, file=sys.stderr)
zz=1
from math import *
#sys.setrecursionlimit(10**6)
if zz:
	input=sys.stdin.readline
else:
	sys.stdin=open('input.txt', 'r')
	sys.stdout=open('all.txt','w')

t=int(input())
while t>0:
	t-=1
	n=int(input())
	if n%10==0 or len(str(n))==1:
		print(1)
		print(n)
	else:
		print(2)
		print((n//10)*10,n%10)


import math
def facts(n):
    ans = []
    for i in range(2, int(math.sqrt(n)+1)):
        if(n%i==0):
            ans.append(i)
            ans.append(n//i)
    ans = sorted(ans)
    return ans

for _ in range(int(input())):
    p=1
    n = int(input())
    ans = []
    while(p<= len(str(n))):
        rem = n%(10**p)
        if(rem!= 0):
            n-=rem
            ans.append(str(rem))
        p+=1
    print(len(ans))
    print(' '.join(ans))


for _ in range(int(input())):
    n = int(input())
    sn = str(n)
    nums = []
    i = 1
    while(len(str(i)) < len(sn)):
        if(n%10 != 0):
            nums.append(str(n%10*i))
        pn = str(n)
        n = int(pn[:len(pn)-1])
        i*=10
    nums.append(str(n*i))
    print(len(nums))
    print(' '.join(sorted(nums, reverse = True)))


for _ in range(int(input())):
  n = int(input())
  result = []

  power = 1
  while n > 0:
    if n % 10 != 0:
      result.append((n % 10) * power)
    n //= 10
    power *= 10

  print(len(result))
  for i in result:
    print(i, end=' ')
  print()


for _ in range(int(input())):
  n = input()
  length = len(n)
  for i in range(length):
    if n[i] != '0':
      print(int(n[i]) * (10 ** (length - i - 1)), end=' ')
  print()


for _ in range(int(input())):
  n = int(input())
  result = []

  power = 1
  while n > 0:
    if n % 10 != 0:
      result.append((n % 10) * power)
    n //= 10
    power *= 10

  for i in result:
    print(i, end=' ')
  print()


for _ in range(int(input())):
  n = input()
  result = []
  for i in range(len(n)):
    if n[i] != '0':
      result.append(int(n[i]) * (10 ** (len(n) - i - 1)))
  print(len(result))
  for x in result:
    print(x, end=' ')
  print()


def process(x):
    x = str(x)
    l = list()
    for i in range(len(x)):
        if x[i] == '0':
            continue
        else:
            l.append(x[i]+("0" * (len(x) - i - 1)))
    print(len(l))
    for item in l:
        print(item, end=" ")
    print("")

def main():
    n = int(input())
    l = list()
    for i in range(n):
        l.append(input())

    for i in range(n):
        process(str(l[i]))

if __name__ == "__main__":
    main()


def process(x):
    x = str(x)
    for i in range(len(x)):
        if x[i] == '0':
            continue
        else:
            print("{}{}".format(x[i], ("0" * (len(x) - i - 1))), end=" ")

def main():
    n = int(input())
    l = list()
    for i in range(n):
        l.append(input())

    for i in range(n):
        process(str(l[i]))

if __name__ == "__main__":
    main()


n=int(input())
c=0
for j in range(n):
    m=input()
    l=len(m)
    if m[1:].count("0")==l-1:
        print(1)
        print(m)
        c=0
    else:
        print(l-m.count("0"))
        for i in range(l):
            if m[i]!="0":
                print(m[i]+"0"*((l-1)-i),end=" ")


n=int(input())
c=0
for j in range(n):
    m=input()
    l=len(m)
    if m[1:].count("0")==l-1:
        print(1)
        print(m)
        c=0
    else:
        print(l-m.count("0"))
        for i in range(l):
            if m[i]!="0":
                print(m[i],"0"*((l-1)-i),sep="",end=" ")
        c=1
    if c==1:
        print()


t = int(input())

#a = list(map(int, input().split()))
#x, y = input("Enter a two value: ").split()
for _ in range(t):
  n = input()
  for i in range(len(n)):
    p = int(n[i])*(10**(len(n)-i-1))
    if p!=0:
      print(p, end=" ")


t = int(input())

#a = list(map(int, input().split()))
#x, y = input("Enter a two value: ").split()
for _ in range(t):
  n = input()
  print(len(n))
  for i in range(len(n)):
    p = int(n[i])*(10**(len(n)-i-1))
    if p!=0:
      print(p, end=" ")
  print("")


t = int(input())

#a = list(map(int, input().split()))
#x, y = input("Enter a two value: ").split()
for _ in range(t):
  n = input()
  for i in range(len(n)):
    p = int(n[i])*(10**(len(n)-i-1))
    if p!=0:
      print(p, end=" ")
  print("")


t = int(input())

#a = list(map(int, input().split()))
#x, y = input("Enter a two value: ").split()
for _ in range(t):
  n = input()
  d = n
  print(len(d.replace('0', '')))
  for i in range(len(n)):
    p = int(n[i])*(10**(len(n)-i-1))
    if p!=0:
      print(p, end=" ")
  print("")


l='123456789'
for _ in range(int(input())):
    n=int(input())
    n=list(str(n))
    ans=[]
    for i in range(len(n)):
        if(n[i] in l):
            a=n[i]+'0'*(len(n)-i-1)
            a=''.join(a)
            ans.append(int(a))
    print(len(ans))
    print(*ans)


l='123456789'
for _ in range(int(input())):
    n=int(input())
    n=list(str(n))
    ans=[]
    for i in range(len(n)):
        if(n[i] in l):
            a=n[i]+'0'*(len(n)-i-1)
            a=''.join(a)
            ans.append(int(a))
    print(*ans)


t = int(input())
for i in range(t):
    n = int(input())
    table = list(str(n))
    table2 = []
    for i in table:
        a = 10**(len(table) - (table.index(i) + 1))
        b = int(i)
        table2.append(a * b)
        if 0 in table2:
            table2.remove(0)
    print(len(table2))
    print(*table2)


t = int(input())
for i in range(t):
    n = int(input())
    table = list(str(n))
    table2 = []
    x = len(table)
    for i in table:
        x -= 1
        a = 10**x
        b = int(i)
        table2.append(a * b)
    while 0 in table2:
        table2.remove(0)
    print(len(table2))
    print(*table2)


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("tune=native")
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define sqr(x) x * x
#define forn( i, n) for (int i = 0; i < (int)n; ++i)
#define all(i) i.begin(), i.end()
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <fstream>
#include <queue>
#include <ctime>
#include <map>
#include <set>
#include <random>
#include<iomanip>
#include<future>
template<typename T>
inline  T abs(const T& a)
{
	return a < 0 ? -a : a;
}
using namespace std;
void boost()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
}
void spr(int x) { cout << setprecision(x) << fixed; }
int main()
{
	boost();
	int t;
	cin >> t;
	while (t-- > 0)
	{
		int n, m, k;
		cin >> n >> m >> k;
		vector<int> a(n);
		for (int i = 0; i < n; i++) cin >> a[i];
		for (int i = 0; i < n - 1; i++)
		{
			if (abs(a[i] - a[i + 1]) > m + k) goto no;
			m += a[i] - a[i + 1];
			m += min(a[i + 1], k);
		}
		cout << "YES" << "\n";
		continue;
	no:
		cout << "NO" << "\n";
	}
}


#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define ll long long
int main()
{
	int test_count; cin >> test_count;
	for (size_t test_no = 0; test_no < test_count; test_no++)
	{
		ll num_cols, available_blocks, jump_height;
		cin >> num_cols >> available_blocks >> jump_height;
		vector<int> column_heights(num_cols);
		for (size_t i = 0; i < num_cols; i++)
			cin>>column_heights[i];

		bool possible = true;
		for (size_t i = 0; i < num_cols-1 && possible; i++)
		{
			available_blocks += column_heights[i];
			if (jump_height < column_heights[i+1])
			{
				available_blocks -= (column_heights[i + 1] - jump_height);
			}
			if (available_blocks < 0)
				possible = false;
		}
		if (possible)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}


#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define ll long long
int main()
{
	int test_count; cin >> test_count;
	for (size_t test_no = 0; test_no < test_count; test_no++)
	{
		ll num_cols, available_blocks, jump_height;
		cin >> num_cols >> available_blocks >> jump_height;
		vector<int> column_heights(num_cols);
		for (size_t i = 0; i < num_cols; i++)
			cin>>column_heights[i];

		bool possible = true;
		for (size_t i = 0; i < num_cols-1 && possible; i++)
		{
			available_blocks += column_heights[i] + jump_height - column_heights[i + 1];
			if (available_blocks < 0)
				possible = false;
		}
		if (possible)
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <vector>
#include <math.h>
using namespace std;

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int n, m, k;
		bool flag = true;
		cin >> n >> m >> k;
		vector<int>blocks(n);
		for (int i = 0; i < n; i++)cin >> blocks[i];
		for (int i = 0; i < n - 1; i++)
		{
			int SL = blocks[i + 1] - k;
			if (m + blocks[i] < SL) { flag = false; break; }
			if (blocks[i] > SL)m += blocks[i] - SL;
			else m -= SL - blocks[i];
		}
		if (flag)cout << "YES\n";
		else cout << "NO\n";
	}
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		ll n, m, k;
		bool flag = true;
		cin >> n >> m >> k;
		vector<ll>blocks(n);
		for (int i = 0; i < n; i++)cin >> blocks[i];
		for (int i = 0; i < n - 1; i++)
		{
			ll SL = max((ll)0, blocks[i + 1] - k);
			if (m + blocks[i] < SL) { flag = false; break; }
			if (blocks[i] > SL)m += blocks[i] - SL;
			else m -= SL - blocks[i];
		}
		if (flag)cout << "YES\n";
		else cout << "NO\n";
	}
}


#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		ll n, m, k;
		bool flag = true;
		cin >> n >> m >> k;
		vector<ll>blocks(n);
		for (int i = 0; i < n; i++)cin >> blocks[i];
		for (int i = 0; i < n - 1; i++)
		{
			ll SL = blocks[i + 1] - k;
			if (m + blocks[i] < SL) { flag = false; break; }
			if (blocks[i] > SL)m += blocks[i] - SL;
			else m -= SL - blocks[i];
		}
		if (flag)cout << "YES\n";
		else cout << "NO\n";
	}
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<vector>
#include<string>
#define ll long long
using namespace std;
ll a[10010];
int main()
{
	int t;
	while(~scanf("%d",&t))
	{
		while(t--)
		{
			ll n,m,k;
			scanf("%lld%lld%lld",&n,&m,&k);
			for(int i=0;i<n;i++)
			{
				scanf("%lld",&a[i]);
			}
			int flag=0;
			for(int i=0;i<n-1;i++)
			{
				ll x=a[i+1]-a[i];
				ll y=-x;

				if(x<0)
				{
					if(y+k<=a[i])
					m+=(y+k);
					else
					m+=a[i];
				}
				else if(y<0)
				{
					if(x<k)
					{
						if(k-x<=a[i])
						m+=(k-x);
						else
						m+=a[i];
						continue;
					}
					if(x-m>k)
					{
						flag=1;
						break;
					}
					else
					{
						m-=(x-k);
					}
				}
				else
				{
					if(x==0)
					{
						if(k<=a[i])
						{
							m+=k;
						}
						else
						m+=a[i];
					}
				}
			}
			if(flag==1)
			printf("NO\n");
			else
			printf("YES\n");
		}
	}
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<vector>
#include<string>
#define ll long long
using namespace std;
ll a[10010];
int main()
{
	int t;
	while(~scanf("%d",&t))
	{
		while(t--)
		{
			ll n,m,k;
			scanf("%lld%lld%lld",&n,&m,&k);
			for(int i=0;i<n;i++)
			{
				scanf("%lld",&a[i]);
			}
			int flag=0;
			for(int i=0;i<n-1;i++)
			{
				ll x=a[i+1]-a[i];
				ll y=-x;

				if(x<0)
				{
					if(y+k<=a[i])
					m+=(y+k);
					else
					m+=a[i];
				}
				else if(y<0)
				{
					if(x<k)
					{
						if(k-x<=a[i])
						m+=(k-x);
						else
						m+=a[i];
						continue;
					}
					if(x-m>k)
					{
						flag=1;
						break;
					}
					else
					{
						m-=(x-k);
					}
				}
			}
			if(flag==1)
			printf("NO\n");
			else
			printf("YES\n");
		}
	}
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<vector>
#include<string>
#define ll long long
using namespace std;
ll a[10010];
int main()
{
	int t;
	while(~scanf("%d",&t))
	{
		while(t--)
		{
			ll n,m,k;
			scanf("%lld%lld%lld",&n,&m,&k);
			for(int i=0;i<n;i++)
			{
				scanf("%lld",&a[i]);
			}
			int flag=0;
			for(int i=0;i<n-1;i++)
			{
				ll x=a[i+1]-a[i];
				ll y=-x;

				if(x<0)
				{
					m+=(y+k);
				}
				else if(y<0)
				{
					if(x-m>k)
					{
						flag=1;
						break;
					}
					else
					{
						m-=(x-k);
					}
				}
			}
			if(flag==1)
			printf("NO\n");
			else
			printf("YES\n");
		}
	}
}


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<vector>
#include<string>
#define ll long long
using namespace std;
ll a[10010];
int main()
{
	int t;
	while(~scanf("%d",&t))
	{
		while(t--)
		{
			ll n,m,k;
			scanf("%lld%lld%lld",&n,&m,&k);
			for(int i=0;i<n;i++)
			{
				scanf("%lld",&a[i]);
			}
			int flag=0;
			for(int i=0;i<n-1;i++)
			{
				ll x=a[i+1]-a[i];
				ll y=-x;

				if(x<0)
				{
					if(y+k<=a[i])
					m+=(y+k);
					else
					m+=a[i];
				}
				else if(y<0)
				{
					if(x-m>k)
					{
						flag=1;
						break;
					}
					else
					{
						m-=(x-k);
					}
				}
			}
			if(flag==1)
			printf("NO\n");
			else
			printf("YES\n");
		}
	}
}


#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        int n;
        cin>>n;
        int bag;
        cin>>bag;
        int k;
        cin>>k;

        int* arr = new int[n];
        for(int i=0;i<n;i++)
            cin>>arr[i];
        int flag = 0;
        for(int i=0;i<n-1;i++)
        {
            if(arr[i]>=arr[i+1])
            {
                bag += arr[i] - arr[i+1];
            }
            else
            {
                if(arr[i+1] - arr[i] > k)
                {
                    if(arr[i+1] - arr[i] - bag > k)
                    {
                        flag = 1;
                        break;
                    }
                    else if(arr[i+1] - arr[i] - bag == k)
                    {
                        bag = 0;
                    }
                    else
                    {
                        bag = bag + k + arr[i] - arr[i+1];
                    }
                }
                else if(arr[i+1] - arr[i] < k)
                {
                    bag = bag + min(arr[i],k-arr[i+1] + arr[i]);
                }
            }
        }
        if(flag == 0)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;

    }
}


#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        int n;
        cin>>n;
        int bag;
        cin>>bag;
        int k;
        cin>>k;

        int* arr = new int[n];
        for(int i=0;i<n;i++)
            cin>>arr[i];
        int flag = 0;
        for(int i=0;i<n-1;i++)
        {
            if(arr[i]>=arr[i+1])
            {
                bag = bag + min(arr[i],arr[i]-arr[i+1] + k);
            }
            else
            {
                if(arr[i+1] - arr[i] > k)
                {
                    if(arr[i+1] - arr[i] - bag > k)
                    {
                        flag = 1;
                        break;
                    }
                    else if(arr[i+1] - arr[i] - bag == k)
                    {
                        bag = 0;
                    }
                    else
                    {
                        bag = bag + k + arr[i] - arr[i+1];
                    }
                }
                else if(arr[i+1] - arr[i] < k)
                {
                    bag = bag + min(arr[i],k-arr[i+1] + arr[i]);
                }
            }
        }
        if(flag == 0)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;

    }
}


#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        int n;
        cin>>n;
        int bag;
        cin>>bag;
        int k;
        cin>>k;

        int arr[n];
        for(int i=0;i<n;i++)
            cin>>arr[i];
        int flag = 0;
        for(int i=0;i<n-1;i++)
        {
            if(arr[i]>=arr[i+1])
            {
                bag += arr[i] - arr[i+1];
            }
            else
            {
                if(arr[i+1] - arr[i] > k)
                {
                    if(arr[i+1] - arr[i] - bag > k)
                    {
                        flag = 1;
                        break;
                    }
                    else if(arr[i+1] - arr[i] - bag == k)
                    {
                        bag = 0;
                    }
                    else
                    {
                        bag = bag + k + arr[i] - arr[i+1];
                    }
                }
                else if(arr[i+1] - arr[i] < k)
                {
                    bag = bag + min(arr[i],k-arr[i+1] + arr[i]);
                }
            }
        }
        if(flag == 0)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;

    }
}


// Test.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <cctype>
#include <math.h>
#include <vector>
#include <fstream>;
#define MAXN 100001
#define ll long long
//cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');
using namespace std;
int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		ll n, m, k;
		cin >> n >> m >> k;
		ll* arr = new ll[n];
		bool winnable = true;
		for (int i = 0; i < n; i++)
		{
			cin >> arr[i];
		}
		for (int i = 0; i < n-1; i++)
		{
			if (arr[i] - arr[i+1] >= -k)
			{

				//need: arr[i+1]-k
				ll excess = (arr[i] - (arr[i + 1] - k));
				if (arr[i] >= excess)
				{
					m += excess;
				}
				else
				{
					m += arr[i];
				}
			}
			else
			{
				m -= (arr[i + 1] - k - arr[i]);
				if (m < 0)
				{
					winnable = false;
					break;
				}
			}
		}
		if (winnable||n==1)
		{
			cout << "YES\n";
		}
		else
		{
			cout << "NO\n";
		}
	}
	return 0;
}


// Test.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <cctype>
#include <math.h>
#include <vector>
#include <fstream>;
#define MAXN 100001
#define ll long long
//cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');
using namespace std;
int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		ll n, m, k;
		cin >> n >> m >> k;
		ll* arr = new ll[n];
		bool winnable = true;
		for (int i = 0; i < n; i++)
		{
			cin >> arr[i];
		}
		for (int i = 0; i < n-1; i++)
		{
			if (arr[i] - arr[i+1] >= -k)
			{

				//need: arr[i+1]-k
				m += (arr[i] - (arr[i + 1] - k));
			}
			else
			{
				m -= (arr[i + 1] - k - arr[i]);
				if (m < 0)
				{
					winnable = false;
					break;
				}
			}
		}
		if (winnable)
		{
			cout << "YES\n";
		}
		else
		{
			cout << "NO\n";
		}
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
inline int read()
{
	int s=0;
	char ch=getchar();
	while(ch>'9'||ch<'0') ch=getchar();
	while(ch>='0'&&ch<='9')
	{
		s=s*10+ch-48;
		ch=getchar();
	}
	return s;
}
int t,n,m,k;
int a[200];
int main()
{
	t=read();
	while(t--)
	{
		n=read();m=read();k=read();
		for(int i=1;i<=n;i++ ) a[i]=read();
		if(n==1)
		{
			printf("Yes\n");continue;
		}
		for(int i=2;i<=n;i++)
		{

			if(a[i-1]>a[i]-k)
			{
				m+=a[i-1]-a[i]+k;continue;
			}
			else m-=(a[i]-k-a[i-1]);
			if(m<0)
			{
				printf("No\n");goto Z;
			}
		}
		if(m<0)
		{
			printf("No\n");goto Z;
		}
		printf("Yes\n");
		Z:;
	}

	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
inline int read()
{
	int s=0;
	char ch=getchar();
	while(ch>'9'||ch<'0') ch=getchar();
	while(ch>='0'&&ch<='9')
	{
		s=s*10+ch-48;
		ch=getchar();
	}
	return s;
}
int t,n,m,k;
int a[200];
int main()
{
	scanf("%d",&t);
	while(t--)
	{
		//n=read();m=read();k=read();
		scanf("%d%d%d",&n,&m,&k);
		for(int i=1;i<=n;i++ ) scanf("%d",&a[i]);
		if(n==1)
		{
			printf("YES\n");continue;
		}
		for(int i=2;i<=n;i++)
		{

			if(a[i-1]>a[i]-k)
			{
				if(a[i-1]-a[i]+k<a[i-1]) m+=a[i-1]-a[i]+k;
				else m+=a[i-1];
				continue;
			}
			else m-=(a[i]-k-a[i-1]);
			if(m<0)	break;
		}
		if(m<0)
		{
			printf("NO\n");
		}
		else printf("YES\n");
	}

	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
inline int read()
{
	int s=0;
	char ch=getchar();
	while(ch>'9'||ch<'0') ch=getchar();
	while(ch>='0'&&ch<='9')
	{
		s=s*10+ch-48;
		ch=getchar();
	}
	return s;
}
int t,n,m,k;
int a[200];
int main()
{
	t=read();
	while(t--)
	{
		n=read();m=read();k=read();
		for(int i=1;i<=n;i++ ) a[i]=read();
		if(n==1)
		{
			printf("YES\n");continue;
		}
		for(int i=2;i<=n;i++)
		{

			if(a[i-1]>a[i]-k)
			{
				m+=min(a[i-1]-a[i]+k,a[i-1]);continue;
			}
			else m-=(a[i]-k-a[i-1]);
			if(m<0)	break;
		}
		if(m<0)
		{
			printf("NO\n");
		}
		else printf("YES\n");
	}

	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
inline int read()
{
	int s=0;
	char ch=getchar();
	while(ch>'9'||ch<'0') ch=getchar();
	while(ch>='0'&&ch<='9')
	{
		s=s*10+ch-48;
		ch=getchar();
	}
	return s;
}
int t,n,m,k;
int a[200];
int main()
{
	t=read();
	while(t--)
	{
		n=read();m=read();k=read();
		for(int i=1;i<=n;i++ ) a[i]=read();
		if(n==1)
		{
			printf("Yes\n");continue;
		}
		for(int i=2;i<=n;i++)
		{

			if(a[i-1]>a[i]-k)
			{
				m+=min(a[i-1]-a[i]+k,a[i-1]);continue;
			}
			else m-=(a[i]-k-a[i-1]);
			if(m<0)
			{
				printf("NO\n");goto Z;
			}
		}
		if(m<0)
		{
			printf("NO\n");goto Z;
		}
		printf("YES\n");
		Z:;
	}

	return 0;
}


#include<stdio.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#define ll long long
using namespace std;
const int mod=1e9+7;
const int maxm=1e5+10;
int bl[105];
int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		int n,m,k,flag=0;
		scanf("%d%d%d",&n,&m,&k);
		int re=m;
		for(int i=1;i<=n;i++)
			scanf("%d",&bl[i]);
		int now=bl[1];
		for(int i=2;i<=n;i++)
		{
			if(bl[i]-k<=now)
			{
				if(bl[i]-k>=0)
					re+=now-(bl[i]-k);
				else
					re+=now;
				now=bl[i];
			}
			else
			{
				re-=bl[i]-k-now;
				if(re<0)
				{
					flag=1;
					break;
				}
				now=bl[i];
			}
		}
		if(flag)
			printf("NO\n");
		else
			printf("YES\n");
	}
	return 0;
}


#include<stdio.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#define ll long long
using namespace std;
const int mod=1e9+7;
const int maxm=1e5+10;
int bl[105];
int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		int n,m,k,flag=0;
		scanf("%d%d%d",&n,&m,&k);
		int re=m;
		for(int i=1;i<=n;i++)
			scanf("%d",&bl[i]);
		int now=bl[1];
		for(int i=2;i<=n;i++)
		{
			if(bl[i]-k<=now)
			{
				re+=now-(bl[i]-k);
				now=bl[i];
			}
			else
			{
				re-=bl[i]-k-now;
				if(re<0)
				{
					flag=1;
					break;
				}
				now=bl[i];
			}
		}
		if(flag)
			printf("NO\n");
		else
			printf("YES\n");
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <string>
#include <stack>
using namespace std;
#define sd(n) scanf("%d",&n)
#define sdd(n,m) scanf("%d%d",&n,&m)
#define sddd(n,m,k) scanf("%d%d%d",&n,&m,&k)
#define pd(n) printf("%d\n", (n))
#define pdd(n,m) printf("%d %d", n, m)
#define pld(n) printf("%lld\n", n)
#define pldd(n,m) printf("%lld %lld\n", n, m)
#define sld(n) scanf("%lld",&n)
#define sldd(n,m) scanf("%lld%lld",&n,&m)
#define slddd(n,m,k) scanf("%lld%lld%lld",&n,&m,&k)
#define sf(n) scanf("%lf",&n)
#define sff(n,m) scanf("%lf%lf",&n,&m)
#define sfff(n,m,k) scanf("%lf%lf%lf",&n,&m,&k)
#define ss(str) scanf("%s",str)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mm(a,n) memset(a, n, sizeof(a))
#define debug(x) cout << #x << ": " << x << endl
#define pb push_back
int main(){
	int t;cin>>t;
	int list[105];
	while (t--){
		int n,m,k;
		sddd(n,m,k);
		rep(i,0,n)sd(list[i]);
		int flag=1;
		rep(i,0,n-1){
			int nex=list[i+1];
			if (nex<=list[i]+k+m){
				m=list[i]+k+m-nex;
			}
			else {
				flag=0;
				break;
			}
		}
		if (flag){
			cout<<"YES"<<endl;
		}
		else {
			cout<<"NO"<<endl;
		}
	}
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <string>
#include <stack>
using namespace std;
#define sd(n) scanf("%d",&n)
#define sdd(n,m) scanf("%d%d",&n,&m)
#define sddd(n,m,k) scanf("%d%d%d",&n,&m,&k)
#define pd(n) printf("%d\n", (n))
#define pdd(n,m) printf("%d %d", n, m)
#define pld(n) printf("%lld\n", n)
#define pldd(n,m) printf("%lld %lld\n", n, m)
#define sld(n) scanf("%lld",&n)
#define sldd(n,m) scanf("%lld%lld",&n,&m)
#define slddd(n,m,k) scanf("%lld%lld%lld",&n,&m,&k)
#define sf(n) scanf("%lf",&n)
#define sff(n,m) scanf("%lf%lf",&n,&m)
#define sfff(n,m,k) scanf("%lf%lf%lf",&n,&m,&k)
#define ss(str) scanf("%s",str)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mm(a,n) memset(a, n, sizeof(a))
#define debug(x) cout << #x << ": " << x << endl
#define pb push_back
int main(){
	int t;cin>>t;
	int list[105];
	while (t--){
		int n,m,k;
		sddd(n,m,k);
		rep(i,0,n)sd(list[i]);
		int flag=1,pre=m;
		rep(i,0,n-1){
			int nex=list[i+1];
			if (nex<=list[i]+k+m){
				m=list[i]+k+m-nex;
				if(m-pre>list[i]){
					m=pre+list[i];
				}
				pre=m;
			}
			else {
				flag=0;
				break;
			}
		}
		if (flag){
			cout<<"YES"<<endl;
		}
		else {
			cout<<"NO"<<endl;
		}
	}
}


#define CRT_NO_WARNINGS
#include<iostream>
#include <algorithm>
#include<string>
#include<vector>
#include<string.h>
#include<stdio.h>
#include<map>
using namespace std;
int main()
{
	int q;
	vector<string>s;
	cin >> q;
	for (int i = 0; i < q; i++)
	{
		bool f = true;
		int n, m, k;
		vector<int>v;
		cin >> n >> m >> k;
		for (int j = 0; j < n; j++)
		{
			int get;
			cin >> get;
			v.push_back(get);
		}
		for (int j = 1; j < n; j++)
		{
			int level = v[j] - k;
			if (level < 0)
			{
				m += v[j - 1];
			}
			else m += v[j - 1] - level;
			if (m < 0)
				f = false;
		}
		if (f == false)
			s.push_back("NO");
		else s.push_back("YES");
	}
	for (int i = 0; i < s.size(); i++)
		cout << s[i] << endl;

	//system("pause");
	return 0;
}


#define CRT_NO_WARNINGS
#include<iostream>
#include <algorithm>
#include<string>
#include<vector>
#include<string.h>
#include<stdio.h>
#include<map>
using namespace std;
int main()
{
	int q;
	vector<string>s;
	cin >> q;
	for (int i = 0; i < q; i++)
	{
		bool f = true;
		int n, m, k;
		vector<int>v;
		cin >> n >> m >> k;
		for (int j = 0; j < n; j++)
		{
			int get;
			cin >> get;
			v.push_back(get);
		}
		for (int j = 0; j < n - 1; j++)
		{
			int rez = v[j + 1] - v[j];
				m -= rez - k;
				if (m < 0)
					f = false;
		}
		if (f == false)
			s.push_back("NO");
		else s.push_back("YES");
	}
	for (int i = 0; i < s.size(); i++)
		cout << s[i] << endl;

	//system("pause");
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <xfunctional>
#define ll long long
#define mod 998244353
using namespace std;
int dir[4][2] = { {0,1},{0,-1},{-1,0},{1,0} };
const int maxn = 1e5 + 5;
const long long inf = 0x7f7f7f7f7f7f7f7f;

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int n, m, k, flag = 0;
		cin >> n >> m >> k;
		vector<int> h(n + 1);
		for (int i = 1; i <= n; i++)
		{
			cin >> h[i];
		}
		for (int i = 1; i < n; i++)
		{
			if (h[i + 1] - h[i]<k)
			{
				int tmp = m;
				tmp += h[i] - h[i + 1] + k;
				m = min(tmp, m + h[i]);
			}
			else
			{
				if (h[i + 1] - h[i] - m <= k)
				{
					m -= h[i + 1] - h[i] - k;
				}
				else
				{
					flag = 1;
					cout << "NO" << endl;
					break;
				}
			}
		}
		if (flag)
			continue;
		cout << "YES" << endl;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <unordered_set>
#include <unordered_map>
#include <xfunctional>
#define ll long long
#define mod 998244353
using namespace std;
int dir[4][2] = { {0,1},{0,-1},{-1,0},{1,0} };
const int maxn = 1e5 + 5;
const long long inf = 0x7f7f7f7f7f7f7f7f;

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int n, m, k, flag = 0;
		cin >> n >> m >> k;
		vector<int> h(n + 1);
		for (int i = 1; i <= n; i++)
		{
			cin >> h[i];
		}
		for (int i = 1; i < n; i++)
		{
			if (h[i + 1] - h[i]<k)
			{
				m += h[i] - h[i + 1] + k;
			}
			else
			{
				if (h[i + 1] - h[i] - m <= k)
				{
					m -= h[i + 1] - h[i] - k;
				}
				else
				{
					flag = 1;
					cout << "NO" << endl;
					break;
				}
			}
		}
		if (flag)
			continue;
		cout << "YES" << endl;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <deque>
using namespace std;
int main()
{
	long long int t; cin >> t;
	while (t--)
	{
		long long int n, k;
		long long int bag;
		cin >> n >> bag >> k;
		vector<long long int>c(n);
		bool yes = true;
		for (long long int i=0;i<n;i++)
		{
			cin >> c[i];
			if (i > 0)
			{
				// chceme ist z c[i-1] na c[i]
				long long minh = c[i] - k;
				if (minh < 0) minh = 0;
				if (minh < c[i-1]) bag += c[i-1]-minh;
				else{
					int rozdiel = minh-c[i-1];
					if (bag < rozdiel)
					{
						yes = false;
						break;
					}
					bag -= rozdiel;
				}
				/*long long int minh = max(0LL, c[i]-k);
				bag += c[i-1]-minh; // ak je c[i-1] male, odpocitame inak pripocitame
				if (bag < 0LL)
				{
					yes = false;
					break;
				}*/
			}
		}
		if (yes)
		{
			cout << "YES\n";
		}
		else
		{
			cout << "NO\n";
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <deque>
using namespace std;
int main()
{
	int t; cin >> t;
	while (t--)
	{
		int n, m, k;
		cin >> n >> m >> k;
		vector<int>c(n);
		int bag = m;
		bool yes = true;
		for (int i=0;i<c.size();i++)
		{
			cin >> c[i];
			if (i >= 1)
			{
				if (c[i-1]-(c[i]-k) > c[i-1])
					bag += c[i-1];
				else
					bag += c[i-1]-(c[i]-k);
				if (bag < 0)
				{
					yes = false;
					break;
				}
			}
		}
		if (yes)
		{
			cout << "YES\n";
		}
		else
		{
			cout << "NO\n";
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <deque>
using namespace std;
int main()
{
	int t; cin >> t;
	while (t--)
	{
		int n, m, k;
		cin >> n >> m >> k;
		vector<int>c(n);
		int bag = m;
		bool yes = true;
		for (int i=0;i<c.size();i++)
		{
			cin >> c[i];
			if (i >= 1)
			{
				// chceme sa dostat z predosleho stlpca na tento stlpec
				if (c[i]-k <= c[i-1]){
					bag += c[i-1]-(c[i]-k); // zoberieme najviac ako sa da
				}
				else if (c[i]-k <= bag+c[i-1])
				{
					bag += c[i-1]-(c[i]-k);
				}
				else
				{
					yes = false;
				}
			}
		}
		if (yes)
		{
			cout << "YES\n";
		}
		else
		{
			cout << "NO\n";
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <deque>
using namespace std;
int main()
{
	long long int t; cin >> t;
	while (t--)
	{
		long long int n, k;
		long long int bag ;
		cin >> n >> bag >> k;
		vector<long long int>c(n);
		bool yes = true;
		for (long long int i=0;i<n;i++)
		{
			cin >> c[i];
			if (i > 0)
			{
				// chceme ist z c[i-1] na c[i]
				long long minh = c[i] - k;
				if (minh < 0) minh = 0;
				if (minh < c[i-1]) bag += c[i-1]-minh;  // odoberam a pridvam do bagu
				else{
					int rozdiel = minh-c[i-1];
					if (bag < rozdiel)
					{
						yes = false;
					}
					bag -= rozdiel;
				}
				/*long long int minh = max(0LL, c[i]-k);
				bag += c[i-1]-minh; // ak je c[i-1] male, odpocitame inak pripocitame
				if (bag < 0LL)
				{
					yes = false;
					break;
				}*/
			}
		}
		if (yes)
		{
			cout << "YES\n";
		}
		else
		{
			cout << "NO\n";
		}
	}
	return 0;
}


#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>

using namespace std;
int main()
{

    int t;

    cin >> t;
    while (t--) {
        int n, m, k;
        cin >> n >> m >> k;
        vector<int>p(n);
        for (int i = 0; i < n; i++)cin >> p[i];
        bool f = 0;
        for (int i=0; i < n-1; i++) {
            if (p[i] + k >= p[i + 1]) {
                if (p[i] >= p[i + 1]) {
                    if (p[i] + k >= p[i + 1])
                        m += min(p[i] + k - p[i + 1], p[i]);

                }
            }
                else if (p[i] + m + k >= p[i + 1]) {
                    m -= p[i + 1] - p[i] - k;
                }
                else f = 1;

        }
        if (!f)cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;

}


#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>

using namespace std;
int main()
{

    int t;

    cin >> t;
    while (t--) {
        int n, m, k;
        cin >> n >> m >> k;
        vector<int>p(n);
        for (int i = 0; i < n; i++)cin >> p[i];
        bool f = 0;
        for (int i=0; i < n-1; i++) {

            int d = max(0, p[i + 1] - k);
            m += p[i] + d;
            if (m < 0)f = 1;

        }
        if (!f)cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;

}


#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>

using namespace std;
int main()
{

    int t;

    cin >> t;
    while (t--) {
        int n, m, k;
        cin >> n >> m >> k;
        vector<int>p(n);
        for (int i = 0; i < n; i++)cin >> p[i];
        bool f = 0;
        for (int i=0; i < n-1; i++) {

            int d = max(0, p[i + 1] - k);
            m += p[i] - d;
            if (m < 0)f = 1;

        }
        if (!f)cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;

}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <fstream>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include<unordered_map>
#include<iterator>
#include<climits>

#define LL long long
#define debug cout<<"Error!"
#define INF 0x7f7f7f7f7f7f7f7f
#define PI atan(1.0)*4
#define ll long long

using namespace std;

typedef double db;
const ll MM = 1e9 + 7;
ll qpow(ll x, ll n)
{
	ll ans = 1ll;
	while (n)
	{
		if (n & 1ll)
		{
			ans = (ans * x) % MM;
		}
		x = (x * x) % MM;
		n >>= 1;
	}
	return ans;
}
typedef pair<ll, ll> pp;
ll gcd(ll a, ll b)
{
	ll c = a % b;
	while (b!=0)
	{
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}

int main()
{
	ll n, m, k, h[1005];
	int t;
	cin >> t;
	while (t--)
	{
		cin >> n >> m >> k;
		for (int i = 0; i < n; i++)
		{
			cin >> h[i];
		}
		int flag = 1;
		for (int i = 0; i < n-1; i++)
		{
			if (h[i] > h[i + 1] - k) {
				m += h[i] - (h[i + 1] - k);
			}
			else if (h[i] < h[i + 1] - k) {
				m -= h[i + 1] - k - h[i];
				if (m < 0) {
					flag = 0;
					break;
				}
			}
		}
		if (flag)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <fstream>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include<unordered_map>
#include<iterator>
#include<climits>

#define LL long long
#define debug cout<<"Error!"
#define INF 0x7f7f7f7f7f7f7f7f
#define PI atan(1.0)*4
#define ll long long

using namespace std;

typedef double db;
const ll MM = 1e9 + 7;
ll qpow(ll x, ll n)
{
	ll ans = 1ll;
	while (n)
	{
		if (n & 1ll)
		{
			ans = (ans * x) % MM;
		}
		x = (x * x) % MM;
		n >>= 1;
	}
	return ans;
}
typedef pair<ll, ll> pp;
ll gcd(ll a, ll b)
{
	ll c = a % b;
	while (b!=0)
	{
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}

int main()
{
	ll n, m, k, h[1005];
	int t;
	cin >> t;
	while (t--)
	{
		cin >> n >> m >> k;
		for (int i = 0; i < n; i++)
		{
			cin >> h[i];
		}
		int flag = 1;
		for (int i = 0; i < n-1; i++)
		{
			if (h[i] >= h[i + 1] - k) {
				m += min(h[i], - (h[i + 1] - k),h[i]);
			}
			else if (h[i] < h[i + 1] - k) {
				m -= h[i + 1] - k - h[i];
				if (m < 0) {
					flag = 0;
					break;
				}
			}
			if (m < 0) {
				flag = 0;
				break;
			}
		}
		if (flag)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <fstream>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include<unordered_map>
#include<iterator>
#include<climits>

#define LL long long
#define debug cout<<"Error!"
#define INF 0x7f7f7f7f7f7f7f7f
#define PI atan(1.0)*4
#define ll long long

using namespace std;

typedef double db;
const ll MM = 1e9 + 7;
ll qpow(ll x, ll n)
{
	ll ans = 1ll;
	while (n)
	{
		if (n & 1ll)
		{
			ans = (ans * x) % MM;
		}
		x = (x * x) % MM;
		n >>= 1;
	}
	return ans;
}
typedef pair<ll, ll> pp;
ll gcd(ll a, ll b)
{
	ll c = a % b;
	while (b!=0)
	{
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}

int main()
{
	ll n, m, k, h[1005];
	int t;
	cin >> t;
	while (t--)
	{
		cin >> n >> m >> k;
		for (int i = 0; i < n; i++)
		{
			cin >> h[i];
		}
		int flag = 1;
		for (int i = 0; i < n-1; i++)
		{
			if (h[i] > h[i + 1] - k) {
				m += h[i] - max(1ll,(h[i + 1] - k));
			}
			else if (h[i] < h[i + 1] - k) {
				m -= h[i + 1] - k - h[i];
				if (m < 0) {
					flag = 0;
					break;
				}
			}
			if (m < 0) {
				flag = 0;
				break;
			}
		}
		if (flag)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <fstream>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include<unordered_map>
#include<iterator>
#include<climits>

#define LL long long
#define debug cout<<"Error!"
#define INF 0x7f7f7f7f7f7f7f7f
#define PI atan(1.0)*4
#define ll long long

using namespace std;

typedef double db;
const ll MM = 1e9 + 7;
ll qpow(ll x, ll n)
{
	ll ans = 1ll;
	while (n)
	{
		if (n & 1ll)
		{
			ans = (ans * x) % MM;
		}
		x = (x * x) % MM;
		n >>= 1;
	}
	return ans;
}
typedef pair<ll, ll> pp;
ll gcd(ll a, ll b)
{
	ll c = a % b;
	while (b!=0)
	{
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}

int main()
{
	ll n, m, k, h[1005];
	int t;
	cin >> t;
	while (t--)
	{
		cin >> n >> m >> k;
		for (int i = 0; i < n; i++)
		{
			cin >> h[i];
		}
		int flag = 1;
		for (int i = 0; i < n-1; i++)
		{
			if (h[i] >= h[i + 1] - k) {
				m += min(h[i] - (h[i + 1] - k),h[i]);
			}
			else if (h[i] < h[i + 1] - k) {
				m -= h[i + 1] - k - h[i];
				if (m < 0) {
					flag = 0;
					break;
				}
			}
			if (m < 0) {
				flag = 0;
				break;
			}
		}
		if (flag)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <fstream>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include<unordered_map>
#include<iterator>
#include<climits>

#define LL long long
#define debug cout<<"Error!"
#define INF 0x7f7f7f7f7f7f7f7f
#define PI atan(1.0)*4
#define ll long long

using namespace std;

typedef double db;
const ll MM = 1e9 + 7;
ll qpow(ll x, ll n)
{
	ll ans = 1ll;
	while (n)
	{
		if (n & 1ll)
		{
			ans = (ans * x) % MM;
		}
		x = (x * x) % MM;
		n >>= 1;
	}
	return ans;
}
typedef pair<ll, ll> pp;
ll gcd(ll a, ll b)
{
	ll c = a % b;
	while (b!=0)
	{
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}

int main()
{
	int n, m, k, h[105];
	int t;
	cin >> t;
	while (t--)
	{
		cin >> n >> m >> k;
		for (int i = 0; i < n; i++)
		{
			cin >> h[i];
		}
		int flag = 1;
		for (int i = 0; i < n-1; i++)
		{
			if (h[i] > h[i + 1] - k) {
				m += h[i] - (h[i + 1] - k);
			}
			else if (h[i] < h[i + 1] - k) {
				m -= h[i + 1] - k - h[i];
				if (m < 0) {
					flag = 0;
					break;
				}
			}
		}
		if (flag)cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;
int main()
{
  int t;
  set<int>aibe;
  map<int,int>maps;
  vector<int>vec;
  cin>>t;
  for(int ii=0;ii<t;ii++)
  {
    int n,m,k,a[100],ar=1;
    cin>>n>>m>>k;
    for(int i=0;i<n;i++)
    {
      cin>>a[i];
      if(i!=0)
      {
        if(a[i]<=a[i-1])
        {
          if(a[i]-k>=0)
          {
          m+=a[i-1]-(a[i]-k);
          }
          else
          {
          m+=a[i-1];
          }
        }
        else
        {
          if(a[i]>a[i-1]+k)
          {
            m-=a[i]-k-a[i-1];
            if(m<0)
            ar=0;
          }
          else
          {
            if(a[i]-k>=0)
            {
            m+=a[i-1]-(a[i]-k);
            }
            else
            {
            m+=a[i-1];
            }
          }
        }
      }
      //cout<<i<<" "<<m<<endl;
    }
    if(ar==1)
    cout<<"YES"<<endl;
    else
    cout<<"NO"<<endl;
  }

}


#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;
int main()
{
  int t;
  set<int>aibe;
  map<int,int>maps;
  vector<int>vec;
  cin>>t;
  for(int ii=0;ii<t;ii++)
  {
    int n,m,k,a[100],ar=1;
    cin>>n>>m>>k;
    for(int i=0;i<n;i++)
    {
      cin>>a[i];
      if(i!=0)
      {
        if(a[i]<=a[i-1])
        {
          m+=a[i-1]-(a[i]-k);
        }
        else
        {
          if(a[i]>a[i-1]+k)
          {
            m-=a[i]-k-a[i-1];
            if(m<0)
            ar=0;
          }
          else
          {
            m+=k-(a[i]-a[i-1]);
          }
        }
      }
    }
    if(ar==1)
    cout<<"YES"<<endl;
    else
    cout<<"NO"<<endl;
  }

}


#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int a[110];
int sum;

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int n, m, k;
		cin >> n >> m >> k;
		if (n == 1)
		{
			cout << "YES" << endl;
			continue;
		}
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
		}
		int flag = 0;
		for (int i = 1; i < n; i++)
		{
			if (a[i] - a[i + 1] >= 0)
			{
				if (a[i] - a[i + 1] >= k)
				{
					m += a[i] - a[i + 1] + k;
				}
				else
				{
					if (a[i] + m - a[i + 1] - k >= 0)
					{
						m += (a[i] - k - a[i - 1]);
					}
					else
					{
						cout << "NO" << endl;
						flag = 1;
						break;
					}
				}
			}
			else
			{
				if (a[i + 1] - a[i] <= k)
				{
					m += k - (a[i + 1] - a[i]);
				}
				else
				{
					if (a[i + 1] - (a[i] + k) > m)
					{
						cout << "NO" << endl;
						flag = 1;
						break;
					}
					else
					{
						m -= a[i + 1] - (a[i] + k);
					}
				}
			}
		}
		if (flag)
			continue;
		cout << "YES" << endl;
	}
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int a[110];
int sum;

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int n, m, k;
		cin >> n >> m >> k;
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
		}
		if (n == 1)
		{
			cout << "YES" << endl;
			continue;
		}
		int flag = 0;
		for (int i = 1; i < n; i++)
		{
			if (a[i] - a[i + 1] >= 0)
			{
				if (a[i] - a[i + 1] + k > a[i])
					m += a[i];
				else
					m += a[i] - a[i + 1] + k;
			}
			else
			{
				if (a[i + 1] - a[i] <= k)
				{
					if (k - (a[i + 1] - a[i]) > a[i])
						m += a[i];
					else
						m += k - (a[i + 1] - a[i]);
				}
				else
				{
					if (a[i + 1] - (a[i] + k) > m)
					{
						cout << "NO" << endl;
						flag = 1;
						break;
					}
					else
					{
						m -= a[i + 1] - (a[i] + k);
					}
				}
			}
		}
		if (flag)
			continue;
		cout << "YES" << endl;
	}
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int a[110];
int sum;

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int n, m, k;
		cin >> n >> m >> k;
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
		}
		if (n == 1)
		{
			cout << "YES" << endl;
			continue;
		}
		int flag = 0;
		for (int i = 1; i < n; i++)
		{
			if (a[i] - a[i + 1] >= 0)
			{
				if (a[i] - a[i + 1] + k > a[i])
					m += a[i];
				else
					m += a[i] - a[i + 1] + k;
			}
			else
			{
				if (a[i + 1] - a[i] <= k)
				{
					m += k - (a[i + 1] - a[i]);
				}
				else
				{
					if (a[i + 1] - (a[i] + k) > m)
					{
						cout << "NO" << endl;
						flag = 1;
						break;
					}
					else
					{
						m -= a[i + 1] - (a[i] + k);
					}
				}
			}
		}
		if (flag)
			continue;
		cout << "YES" << endl;
	}
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int a[110];
int sum;

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int n, m, k;
		cin >> n >> m >> k;
		if (n == 1)
		{
			cout << "YES" << endl;
			continue;
		}
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
		}
		int flag = 0;
		for (int i = 1; i < n; i++)
		{
			if (a[i] - a[i + 1] >= 0)
			{
				m += a[i] - a[i + 1] + k;
			}
			else
			{
				if (a[i + 1] - a[i] <= k)
				{
					m += k - (a[i + 1] - a[i]);
				}
				else
				{
					if (a[i + 1] - (a[i] + k) > m)
					{
						cout << "NO" << endl;
						flag = 1;
						break;
					}
					else
					{
						m -= a[i + 1] - (a[i] + k);
					}
				}
			}
		}
		if (flag)
			continue;
		cout << "YES" << endl;
	}
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int a[110];
int sum;

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int n, m, k;
		cin >> n >> m >> k;
		if (n == 1)
		{
			cout << "YES" << endl;
			continue;
		}
		for (int i = 1; i <= n; i++)
		{
			cin >> a[i];
		}
		int flag = 0;
		for (int i = 1; i < n; i++)
		{
			if (a[i] - a[i + 1] >= 0)
			{
				if (a[i] - a[i + 1] + k > a[i])
					m += a[i];
				else
					m += a[i] - a[i + 1] + k;
			}
			else
			{
				if (a[i + 1] - a[i] <= k)
				{
					m += k - (a[i + 1] - a[i]);
				}
				else
				{
					if (a[i + 1] - (a[i] + k) > m)
					{
						cout << "NO" << endl;
						flag = 1;
						break;
					}
					else
					{
						m -= a[i + 1] - (a[i] + k);
					}
				}
			}
		}
		if (flag)
			continue;
		cout << "YES" << endl;
	}
	return 0;
}


#include<iostream>
using namespace std;
int column[105];

int main() {
	int nc;
	while (cin >> nc) {
		while (nc--) {
			int n,m,k, currentPos = 0;
			cin >> n >> m >> k;
			for (int x = 0; x < n; x++) {
				cin >> column[x];
			}
			for (int i = 0; i < (n - 1); i++) {
				//�����ֱ���ƶ�
				if (column[i] == column[i + 1]) {
					currentPos++;
					continue;
				}
				if (column[i] > column[i + 1]) {
					m += (column[i] - column[i + 1]);
					currentPos++;
					continue;
				}
				if (column[i] < column[i + 1]) {
					int diff = column[i + 1] - column[i];
					if (diff > k)  {
						if ((diff - k) > m) break;
						m -= (diff - k);
					}
					currentPos++;
					continue;
				}
			}
			if (currentPos != (n - 1)) {
				cout << "NO" << endl;
				continue;
			}
			cout << "YES" << endl;

		}
	}
}


#include<iostream>
using namespace std;
int column[105];

int main() {
	int nc;
	while (cin >> nc) {
		while (nc--) {
			int n,m,k, currentPos = 0;
			cin >> n >> m >> k;
			for (int x = 0; x < n; x++) {
				cin >> column[x];
			}
			for (int i = 0; i < (n - 1); i++) {
				int kdiff = column[i + 1] - k;
				m += (column[i] - kdiff);
				if (m < 0) break;
				currentPos++;
//				//�����ֱ���ƶ�
//				if (column[i] == column[i + 1]) {
//					m += (column[i] >= k) ? k : column[i];
//					currentPos++;
//					continue;
//				}
//				if (column[i] > column[i + 1]) {
//					int diff = (column[i] - column[i + 1]);
//					m += diff;
//					m += (column[i + 1] >= k) ? k : column[i + 1];
//					currentPos++;
//					continue;
//				}
//				if (column[i] < column[i + 1]) {
//
//					int kdiff = column[i + 1] - k;
//					if (kdiff <= 0) {
//						m += column[i];
//					} else {
//						m += (column[i] - kdiff);
//					}
//					currentPos++;
//					continue;
//				}
			}
			if (currentPos != (n - 1)) {
				cout << "NO" << endl;
				continue;
			}
			cout << "YES" << endl;

		}
	}
}


#include<iostream>
using namespace std;
int column[105];

int main() {
	int nc;
	while (cin >> nc) {

		while (nc--) {
			int n,m,k, currentPos = 0;
			cin >> n >> m >> k;
			for (int x = 0; x < n; x++) {
				cin >> column[x];
			}
			for (int i = 0; i < (n - 1); i++) {
				int kdiff = column[i + 1] - k;
				if (kdiff <= 0) {
					m += column[i];
				} else {
					m += (column[i] - kdiff);
				}

				if (m < 0) break;
				currentPos++;
//				//�����ֱ���ƶ�
//				if (column[i] == column[i + 1]) {
//					m += (column[i] >= k) ? k : column[i];
//					currentPos++;
//					continue;
//				}
//				if (column[i] > column[i + 1]) {
//					int diff = (column[i] - column[i + 1]);
//					m += diff;
//					m += (column[i + 1] >= k) ? k : column[i + 1];
//					currentPos++;
//					continue;
//				}
//				if (column[i] < column[i + 1]) {
//
//					int kdiff = column[i + 1] - k;
//					if (kdiff <= 0) {
//						m += column[i];
//					} else {
//						m += (column[i] - kdiff);
//					}
//					currentPos++;
//					continue;
//				}
			}
			if (currentPos != (n - 1)) {
				cout << "NO" << endl;
				continue;
			}
			cout << "YES" << endl;

		}
	}
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 300002
#define ll  long long
int main(){
	ios_base::sync_with_stdio(false);
	bool b=true;
	 ll q,x,m,k;
	cin>>q;
	while (q--)
	{
		b=true;
		cin>>x>>m>>k;
		ll *y=new ll [x];
		for (int i=0;i<x;i++)
			cin>>y[i];
		if (x==1)
			cout<<"YES\n";
		else
		{
			for (int i=0;i<x-1;i++)
			{
				if (y[i]>=y[i+1])
					m+=(y[i]-y[i+1]+k);
				else
				{
					if (y[i]+m>=y[i+1])
						m=((y[i]+m)-(y[i+1]-k));
					else
						b=false;
				}

			}
			if (!b)
				cout<<"NO\n";
			else
				cout<<"YES\n";
		}
	}
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 300002
#define ll  long long
int main(){
	ios_base::sync_with_stdio(false);
	bool b=true;
	 ll q,x,m,k;
	cin>>q;
	while (q--)
	{
		b=true;
		cin>>x>>m>>k;
		ll *y=new ll [x];
		for (int i=0;i<x;i++)
			cin>>y[i];
		if (x==1)
			cout<<"YES\n";
		else
		{
			for (int i=0;i<x-1;i++)
			{
				if (y[i]>=y[i+1]){
					if (y[i+1]>=k)
					m+=(y[i]-(y[i+1]-k));
					else
						m+=y[i];
				}
				else
				{
					if (y[i]+m>=y[i+1]-k)
						m=((y[i]+m)-(y[i+1]-k));

					else
						b=false;
				}

			}
			if (!b)
				cout<<"NO\n";
			else
				cout<<"YES\n";
		}

	}
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 300002
#define ll  long long
int main(){
	ios_base::sync_with_stdio(false);
	bool b=true;
	 ll q,x,m,k;
	cin>>q;
	while (q--)
	{
		b=true;
		cin>>x>>m>>k;
		ll *y=new ll [x];
		for (int i=0;i<x;i++)
			cin>>y[i];
		if (x==1)
			cout<<"YES\n";
		else
		{
			for (int i=0;i<x-1;i++)
			{
				if (y[i]>=y[i+1]){
					if (y[i+1]>=k)
					m+=(y[i]-(y[i+1]-k));
					else
						m+=y[i];
				}
				else
				{
					if (y[i+1]-k<0){
						m+=y[i];
						continue;
					}
					else if (y[i]+m>=y[i+1]-k)
						m=((y[i]+m)-(y[i+1]-k));

					else
						b=false;
				}

			}
			if (!b)
				cout<<"NO\n";
			else
				cout<<"YES\n";
		}

	}
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 300002
#define ll  long long
int main(){
	ios_base::sync_with_stdio(false);
	bool b=true;
	 ll q,x,m,k;
	cin>>q;
	while (q--)
	{
		b=true;
		cin>>x>>m>>k;
		ll *y=new ll [x];
		for (int i=0;i<x;i++)
			cin>>y[i];
		if (x==1)
			cout<<"YES\n";
		else
		{
			for (int i=0;i<x-1;i++)
			{
				if (y[i]>=y[i+1])
					m+=(y[i]-y[i+1]+k);
				else
				{
					if (y[i]+m>=y[i+1])
						m=((y[i]+m)-(y[i+1]-k));
					else
						b=false;
				}

			}
		}
			if (!b)
				cout<<"NO\n";
			else
				cout<<"YES\n";

	}
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 300002
#define ll  long long
int main(){
	ios_base::sync_with_stdio(false);
	bool b=true;
	int q,x,m,k;
	cin>>q;
	while (q--)
	{
		b=true;
		cin>>x>>m>>k;
		int *y=new int [x];
		for (int i=0;i<x;i++)
			cin>>y[i];
		if (x==1)
			cout<<"YES\n";
		else
		{
			for (int i=0;i<x-1;i++)
			{
				if (y[i]>=y[i+1])
					m+=(y[i]-y[i+1]+k);
				else
				{
					if (y[i]+m>=y[i+1])
					{
						m-=(y[i]+m)-(y[i+1]-k);
					}
					else
						b=false;
				}

			}
			if (!b)
				cout<<"NO\n";
			else
				cout<<"Yes\n";
		}
	}
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 300002
#define ll  long long
int main(){
	ios_base::sync_with_stdio(false);
	bool b=true;
	 ll q,x,m,k;
	cin>>q;
	while (q--)
	{
		b=true;
		cin>>x>>m>>k;
		ll *y=new ll [x];
		for (int i=0;i<x;i++)
			cin>>y[i];
		if (x==1)
			cout<<"YES\n";
		else
		{
			for (int i=0;i<x-1;i++)
			{
				if (y[i]>=y[i+1]){
					if (y[i+1]>=k)
					m+=(y[i]-y[i+1]+k);
					else
						m+=y[i];
				}
				else
				{
					if (y[i]+m>=y[i+1])
						m=((y[i]+m)-(y[i+1]-k));
					else if (y[i]+k>=y[i+1])
						continue;
					else
						b=false;
				}

			}
			if (!b)
				cout<<"NO\n";
			else
				cout<<"YES\n";
		}

	}
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 300002
#define ll  long long
int main(){
	ios_base::sync_with_stdio(false);
	bool b=true;
	int q,x,m,k;
	cin>>q;
	while (q--)
	{
		b=true;
		cin>>x>>m>>k;
		int *y=new int [x];
		for (int i=0;i<x;i++)
			cin>>y[i];
		if (x==1)
			cout<<"YES\n";
		else
		{
			for (int i=0;i<x-1;i++)
			{
				if (y[i]>=y[i+1])
					m+=(y[i]-y[i+1]+k);
				else
				{
					if (y[i]+m>=y[i+1])
					{
						m=(y[i]+m)-(y[i+1]-k);
					}
					else
						b=false;
				}

			}
			if (!b)
				cout<<"NO\n";
			else
				cout<<"Yes\n";
		}
	}
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 300002
#define ll  long long
int main(){
	ios_base::sync_with_stdio(false);
	bool b=true;
	 ll q,x,m,k;
	cin>>q;
	while (q--)
	{
		b=true;
		cin>>x>>m>>k;
		ll *y=new ll [x];
		for (int i=0;i<x;i++)
			cin>>y[i];
		if (x==1)
			cout<<"YES\n";
		else
		{
			for (int i=0;i<x-1;i++)
			{
				if (y[i]>=y[i+1]){
					if (y[i]-y[i+1]-k>=0)
					m+=(y[i]-y[i+1]+k);
					else
						m+=y[i];
				}
				else
				{
					if (y[i]+m>=y[i+1])
						m=((y[i]+m)-(y[i+1]-k));
					else
						b=false;
				}

			}
			if (!b)
				cout<<"NO\n";
			else
				cout<<"YES\n";
		}

	}
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 300002
#define ll  long long
int main(){
	ios_base::sync_with_stdio(false);
	bool b=true;
	 ll q,x,m,k;
	cin>>q;
	while (q--)
	{
		b=true;
		cin>>x>>m>>k;
		ll *y=new ll [x];
		for (int i=0;i<x;i++)
			cin>>y[i];
		if (x==1)
			cout<<"YES\n";
		else
		{
			for (int i=0;i<x-1;i++)
			{
				if (y[i]>=y[i+1]){
					if (y[i+1]>=k)
					m+=(y[i]-y[i+1]+k);
					else
						m+=y[i];
				}
				else
				{
					if (y[i]+m>=y[i+1]-k)
						m=((y[i]+m)-(y[i+1]-k));

					else
						b=false;
				}

			}
			if (!b)
				cout<<"NO\n";
			else
				cout<<"YES\n";
		}

	}
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 300002
#define ll  long long
int main(){
	ios_base::sync_with_stdio(false);
	bool b=true;
	int q,x,m,k;
	cin>>q;
	while (q--)
	{
		b=true;
		cin>>x>>m>>k;
		int *y=new int [x];
		for (int i=0;i<x;i++)
			cin>>y[i];
		if (x==1)
			cout<<"YES\n";
		else
		{
			for (int i=0;i<x-1;i++)
			{
				if (y[i]>=y[i+1])
					m+=(y[i]-y[i+1]+k);
				else
				{
					if (y[i]+m>=y[i+1])
					{
						m-=((y[i]+m)-(y[i+1]-k));
					}
					else
						b=false;
				}

			}
			if (!b)
				cout<<"NO\n";
			else
				cout<<"Yes\n";
		}
	}
	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include <initializer_list>
#include<unordered_set>
#include<map>
#include<cmath>
#include <iterator>
#include<stack>
#include<queue>
#include <iomanip>
#include<math.h>
#include <limits.h>
#include <numeric>
#include <functional>
#include<fstream>
using namespace std;
void past_code();

#define mod 300002
#define ll  long long
int main(){
	ios_base::sync_with_stdio(false);
	bool b=true;
	 ll q,x,m,k;
	cin>>q;
	while (q--)
	{
		b=true;
		cin>>x>>m>>k;
		ll *y=new ll [x];
		for (int i=0;i<x;i++)
			cin>>y[i];
		if (x==1)
			cout<<"YES\n";
		else
		{
			for (int i=0;i<x-1;i++)
			{
				if (y[i]>=y[i+1]){
					if (y[i+1]>=k)
					m+=(y[i]-y[i+1]+k);
					else
						m+=y[i];
				}
				else
				{
					if (y[i]+m>=y[i+1])
						m=((y[i]+m)-(y[i+1]-k));
					else
						b=false;
				}

			}
			if (!b)
				cout<<"NO\n";
			else
				cout<<"YES\n";
		}

	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;

int main() {
	int T; cin >> T;
	while (T--) {
		int flag = 1;
		int n, m, k; cin >> n >> m >> k;
		int h[110];
		memset(h, 0, sizeof(h));
		for (int i = 0; i < n; i++) cin >> h[i];

		for (int i = 1; i < n; i++) {
			if ((h[i] - h[i - 1]) > k + m) {
				flag = 0;
				break;
			}
			else {
				m = m - (h[i] - h[i - 1] - k);
			}
		}

		if (flag == 1)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;

int main() {
	int T; cin >> T;
	while (T--) {
		int flag = 1;
		int n, m, k; cin >> n >> m >> k;
		int h[110];
		for (int i = 0; i < n; i++) {
			cin >> h[i];
		}

		for (int i = 1; i < n; i++) {
			if ((h[i] - h[i - 1]) > k + m) {
				flag = 0;
				break;
			}
			else {
				m = m - (h[i] - h[i - 1] - k);
			}
		}
		if (flag == 1)cout << "YES" << endl;
		else cout << "NO" << endl;

	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;

int main() {
	int T; cin >> T;
	while (T--) {
		int flag = 1;
		int n, m, k; cin >> n >> m >> k;
		int h[1100];
		memset(h, 0, sizeof(h));
		for (int i = 0; i < n; i++) cin >> h[i];

		for (int i = 1; i < n; i++) {
			if ((h[i] - h[i - 1]) > k + m) {
				flag = 0;
				break;
			}
			else {
				if (h[i] < k)m += h[i - 1];
				else
					m = m - (h[i] - h[i - 1] - k);
			}
		}

		if (flag == 1)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;

int h[110];

int jdz(int a, int b) {
	if (a > b)return a - b;
	else return b - a;
}

int main() {
	int T; cin >> T;
	while (T--) {
		int flag = 1;
		int n, m, k; cin >> n >> m >> k;
		for (int i = 0; i < n; i++) {
			cin >> h[i];
		}

		for (int i = 1; i < n; i++) {
			if ((h[i] - h[i - 1]) > k + m) {
				flag = 0;
				break;
			}
			else {
				m = m + h[i - 1] - h[i] + k;
			}
		}
		if (flag == 1)cout << "YES" << endl;
		else cout << "NO" << endl;

	}

	return 0;
}


#include<iostream>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
int main()
{
    ll t,m,n,k,a[105];
    while(cin>>t)
    {
        while(t--)
        {
            ll flag=0;
            cin>>n>>m>>k;
            for(ll i=0; i<n; i++)
                cin>>a[i];
            for(ll i=0; i<n-1; i++)
            {
                if((a[i+1]-m-a[i])>k)
                {
                    cout<<"NO"<<endl;
                    flag=1;
                    break;
                }
                m+=a[i]-a[i+1]+k;
                if(m<0)
                {
                    cout<<"NO"<<endl;
                    flag=1;
                    break;
                }
            }
            if(flag==0)
                cout<<"YES"<<endl;
        }
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<stack>
#include<vector>
#include<queue>
#include<algorithm>
#include<stdlib.h>
#include<math.h>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
ll pp;
ll mm,n,k;
ll abc[105];
int main()
{

    while(cin>>pp)
    {
        while(pp--)
        {
            memset(abc,0,sizeof(abc));
            ll flag=0;
            cin>>n>>mm>>k;

            for(ll i=0; i<n; i++)
                cin>>abc[i];
            for(ll i=0; i<n-1; i++)
            {
                if((abc[i+1]-mm-abc[i])>k)
                {
                    cout<<"NO"<<endl;
                    flag=1;
                    break;
                }
                mm+=(abc[i]-abc[i+1]+k)>abc[i]?abc[i]:(abc[i]-abc[i+1]+k);
                if(mm<0)
                {
                    printf("NO\n");
                    flag=1;
                    break;
                }
            }
            if(flag==0)
                printf("YES\n");
        }
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <string>
#include <iomanip>
#include <set>
#include <map>
#include <queue>
#include <numeric>

using namespace std;

typedef long long li;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define fr first
#define sc second
#define pb push_back
#define mp make_pair
#define forn(i, n) for(int i = 0; i < int(n); ++i)
#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define forb(i, n) for(int i = int(n) - 1; i >= 0; --i)

const int INF = 1e9 + 1000;
const li INF64 = 1e18 + 1000;
const int N = 6 * 100 * 1000 + 100;
const int MOD = 1e9 + 9;

li gcd(li a, li b) {
	return a == 0 ? b : gcd(b % a, a);
}

void spr(int x) { cout << setprecision(x) << fixed; }

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int t;
	cin >> t;
	while (t--) {
		int n, m, k;
		cin >> n >> m >> k;
		vi a(n);
		forn(i, n) cin >> a[i];
		bool ex = false;
		forn(i, n - 1) {
			if (a[i] >= a[i + 1]) {
				m += a[i] - a[i + 1] + min(k, a[i + 1]);
			}
			else {
				int dif = a[i + 1] - a[i];
				if (dif <= k) {
					m += min(k - dif, a[i]);
				}
				else if (dif - k > m) {
					ex = true;
					cout << "NO\n";
					break;
				}
				else {
					m -= dif - k;
				}
			}
		}
		if (!ex) cout << "YES\n";
	}

}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <string>
#include <iomanip>
#include <set>
#include <map>
#include <queue>
#include <numeric>

using namespace std;

typedef long long li;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define fr first
#define sc second
#define pb push_back
#define mp make_pair
#define forn(i, n) for(int i = 0; i < int(n); ++i)
#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define forb(i, n) for(int i = int(n) - 1; i >= 0; --i)

const int INF = 1e9 + 1000;
const li INF64 = 1e18 + 1000;
const int N = 6 * 100 * 1000 + 100;
const int MOD = 1e9 + 9;

li gcd(li a, li b) {
	return a == 0 ? b : gcd(b % a, a);
}

void spr(int x) { cout << setprecision(x) << fixed; }

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int t;
	cin >> t;
	while (t--) {
		int n, m, k;
		cin >> n >> m >> k;
		vi a(n);
		forn(i, n) cin >> a[i];
		bool ex = false;
		forn(i, n - 1) {
			if (a[i] >= a[i + 1]) {
				m += a[i] - a[i + 1] + min(k, a[i] - a[i + 1]);
			}
			else {
				int dif = a[i + 1] - a[i];
				if (dif <= k) {
					m += k - dif;
				}
				if (dif - k > m) {
					ex = true;
					cout << "NO\n";
					break;
				}
				else {
					m -= dif - k;
				}
			}
		}
		if (!ex) cout << "YES\n";
	}

}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <string>
#include <iomanip>
#include <set>
#include <map>
#include <queue>
#include <numeric>

using namespace std;

typedef long long li;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define fr first
#define sc second
#define pb push_back
#define mp make_pair
#define forn(i, n) for(int i = 0; i < int(n); ++i)
#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define forb(i, n) for(int i = int(n) - 1; i >= 0; --i)

const int INF = 1e9 + 1000;
const li INF64 = 1e18 + 1000;
const int N = 6 * 100 * 1000 + 100;
const int MOD = 1e9 + 9;

li gcd(li a, li b) {
	return a == 0 ? b : gcd(b % a, a);
}

void spr(int x) { cout << setprecision(x) << fixed; }

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int t;
	cin >> t;
	while (t--) {
		int n, m, k;
		cin >> n >> m >> k;
		vi a(n);
		forn(i, n) cin >> a[i];
		bool ex = false;
		forn(i, n - 1) {
			if (a[i] >= a[i + 1]) {
				m += a[i] - a[i + 1] + min(k, a[i]);
			}
			else {
				int dif = a[i + 1] - a[i];
				if (dif <= k) {
					m += k - dif;
				}
				if (dif - k > m) {
					ex = true;
					cout << "NO\n";
					break;
				}
				else {
					m -= dif - k;
				}
			}
		}
		if (!ex) cout << "YES\n";
	}

}


#include <cmath>
#include <queue>
#include <deque>
#include <cctype>
#include <string>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

template<class T> inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch))
        w = (ch =='-'), ch = getchar();
    while (isdigit(ch))
        x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}

int T, n, m, k;
int h[105];

int main() {
    read(T);
    while (T--) {
        int flag = 1;
        read(n), read(m), read(k);
        for (int i = 1; i <= n; ++i)
            read(h[i]);
        for (int i = 1; i < n; ++i) {
            if (h[i + 1] - h[i] > k) {
                m -= h[i + 1] - h[i] - k;
                h[i] = h[i + 1] - k;
            }
            if (m < 0) {
                cout << "NO" << endl;
                flag = 0;
                break;
            }
            if (h[i + 1] - h[i] < k && h[i] > 0) {
                m += min(h[i], h[i] - h[i + 1] + k);
                h[i] -= m;
            }
            if (h[i] - h[i + 1] > k || h[i + 1] - h[i] > k) {
                cout << "NO" << endl;
                flag = 0;
                break;
            }
        }
        if (flag)
            cout << "YES" << endl;
    }
    return 0;
}


#include <cmath>
#include <queue>
#include <deque>
#include <cctype>
#include <string>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

template<class T> inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch))
        w = (ch =='-'), ch = getchar();
    while (isdigit(ch))
        x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}

int T, n, m, k;
int h[105];

int main() {
    read(T);
    while (T--) {
        int flag = 1;
        read(n), read(m), read(k);
        for (int i = 1; i <= n; ++i)
            read(h[i]);
        for (int i = 1; i < n; ++i) {
            while (h[i + 1] - h[i] > k && m > 0) {
                h[i]++, m--;
            }
            while (h[i + 1] - h[i] < k && h[i] > 0) {
                h[i]--, m++;
            }
            if (h[i] - h[i + 1] > k || h[i + 1] - h[i] > k) {
                cout << "NO" << endl;
                flag = 0;
                break;
            }
        }
        if (flag)
            cout << "YES" << endl;
    }
    return 0;
}


#include <cmath>
#include <queue>
#include <deque>
#include <cctype>
#include <string>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

template<class T> inline void read(T &x) {
    x = 0;
    char ch = getchar(), w = 0;
    while (!isdigit(ch))
        w = (ch =='-'), ch = getchar();
    while (isdigit(ch))
        x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    x = w ? -x : x;
    return;
}

int T, n, m, k;
int h[105];

int main() {
    read(T);
    while (T--) {
        int flag = 1;
        read(n), read(m), read(k);
        for (int i = 1; i <= n; ++i)
            read(h[i]);
        for (int i = 1; i < n; ++i) {
            if (h[i + 1] - h[i] > k) {
                m -= h[i + 1] - h[i] - k;
                h[i] = h[i + 1] - k;
            }
            if (m < 0) {
                cout << "NO" << endl;
                flag = 0;
                break;
            }
            if (h[i + 1] - h[i] < k) {
                m += min(h[i], h[i] - h[i + 1] + k);
                h[i] = max(0, h[i + 1] - k);
            }
            if (h[i] - h[i + 1] > k || h[i + 1] - h[i] > k) {
                cout << "NO" << endl;
                flag = 0;
                break;
            }
        }
        if (flag)
            cout << "YES" << endl;
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cstring>
#define ll long long
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) ((x)&(-x))
using namespace std;

const int maxn=1e5+10;
const int mod=1e9+7;
const int inf = 0x7fffffff;

int he[maxn];
int main()
{
    int t;
    scanf("%d",&t);
	while(t--) {
		int n, k;
		ll m;
		scanf("%d%lld%d",&n,&m,&k);
		for(int i=1; i<=n; i++) scanf("%d",&he[i]);
		int i;
		for( i=1; i<n; ) {
		   int p=abs(he[i+1]-he[i]);
           if(p <= k) {
           	    int tmp;
           	    if(he[i] >= he[i+1])
           	        tmp = p + min(he[i]-p,k);
           	    else
           	        tmp = min(he[i],k-p);
				m += tmp;
				i++;
		   }
		   else {
		   	  int tmp;
		   	  if(he[i] >= he[i+1]) {
				 tmp = p + min(he[i]-p,k);
				 m += tmp;
				 i++;
			  }
			  else {
			  	 tmp = p-k;
			  	 if(m >= tmp) {
			  	       m -= tmp;
			  	       i++;
			  	 }
			  	 else break;
			  }
	       }
		}
		if(i==n) printf("YES\n");
		else printf("NO\n");
	}
    return 0;
}
//0110
//1111
//0111


#include<iostream>
#include<algorithm>
#include<cstring>
#define ll long long
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) ((x)&(-x))
using namespace std;

const int maxn=1e5+10;
const int mod=1e9+7;
const int inf = 0x7fffffff;

int he[maxn];
int main()
{
    int t;
    scanf("%d",&t);
	while(t--) {
		int n, m, k;
		scanf("%d%d%d",&n,&m,&k);
		for(int i=1; i<=n; i++) scanf("%d",&he[i]);
		int i;
		for( i=1; i<n; ) {
		   int p=abs(he[i+1]-he[i]);
           if(p <= k) {
           	    int tmp;
           	    if(he[i] >= he[i+1])
           	        tmp = min(he[i],p+k);
           	    else
           	        tmp = min(he[i],k-p);
				m += tmp;
				he[i] -= tmp;
				i++;
		   }
		   else {
		   	  int tmp;
		   	  if(he[i] > he[i+1]) {
				 tmp = p + min(he[i],k);
				 m += tmp;
				 he[i] -= tmp;
				 i++;
			  }
			  else {
			  	 tmp = p-k;
			  	 if(m >= tmp)
			  	       m -= tmp;
			  	 else break;
			  	 he[i] += tmp;
			  	 i++;
			  }
	       }
		}
		if(i==n) printf("YES\n");
		else printf("NO\n");
	}
    return 0;
}
//0110
//1111
//0111


#include<iostream>
#include<algorithm>
#include<cstring>
#define ll long long
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) ((x)&(-x))
using namespace std;

const int maxn=1e5+10;
const int mod=1e9+7;
const int inf = 0x7fffffff;

int he[maxn];
int main()
{
    int t;
    scanf("%d",&t);
	while(t--) {
		int n, m, k;
		scanf("%d%d%d",&n,&m,&k);
		for(int i=1; i<=n; i++) scanf("%d",&he[i]);
		int i;
		for( i=1; i<n; ) {
		   int p=abs(he[i+1]-he[i]);
           if(p <= k) {
           	    int tmp;
           	    if(he[i] >= he[i+1])
           	        tmp = min(he[i],2*p);
           	    else
           	        tmp = min(he[i],k-p);
				m += tmp;
				he[i] -= tmp;
				i++;
		   }
		   else {
		   	  int tmp;
		   	  if(he[i] > he[i+1]) {
				 tmp = p + min(he[i],k);
				 m += tmp;
				 he[i]-=tmp;
				 i++;
			  }
			  else {
			  	 tmp = p-k;
			  	 if(m>=tmp)
			  	       m -= tmp;
			  	 else break;
			  	 he[i] += tmp;
			  	 i++;
			  }
	       }
		}
		if(i==n) printf("YES\n");
		else printf("NO\n");
	}
    return 0;
}
//0110
//1111
//0111


#include<iostream>
#include<algorithm>
#include<cstring>
#define ll long long
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) ((x)&(-x))
using namespace std;

const int maxn=1e5+10;
const int mod=1e9+7;
const int inf = 0x7fffffff;

int he[maxn];
int main()
{
    int t;
    scanf("%d",&t);
	while(t--) {
		int n, k;
		ll m;
		scanf("%d%lld%d",&n,&m,&k);
		for(int i=1; i<=n; i++) scanf("%d",&he[i]);
		int i;
		for( i=1; i<n; ) {
		   int p=abs(he[i+1]-he[i]);
           if(p <= k) {
           	    int tmp;
           	    if(he[i] >= he[i+1])
           	        tmp = p + min(he[i]-p,k);
           	    else
           	        tmp = min(he[i],k-p);
				m += tmp;
				i++;
		   }
		   else {
		   	  int tmp;
		   	  if(he[i] >= he[i+1]) {
				 tmp = p + min(he[i],k);
				 m += tmp;
				 i++;
			  }
			  else {
			  	 tmp = p-k;
			  	 if(m >= tmp)
			  	       m -= tmp;
			  	 else break;
			  	 i++;
			  }
	       }
		}
		if(i==n) printf("YES\n");
		else printf("NO\n");
	}
    return 0;
}
//0110
//1111
//0111


#define _CRT_SECURE_NO_WARNINGS
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<cmath>
#include<vector>
#include<string>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define Maxi 1000000
#define INF 0x3f3f3f3f
typedef long long ll;
int h[100];
int main()
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		int n, m, k;
		scanf("%d%d%d", &n, &m, &k);
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &h[i]);
		}
		int num = m;
		bool flag = true;
		for (int i = 1; i < n; i++)
		{
			int number = h[i] - h[i - 1];
			if (number <= k)
			{
				num += (k - number);
			}
			else
			{
				if (num - (number - k) >= 0)
				{
					num -= (number - k);
				}
				else
				{
					flag = false;
				}
			}
		}
		if (flag) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<cmath>
#include<vector>
#include<string>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define Maxi 1000000
#define INF 0x3f3f3f3f
typedef long long ll;
int h[100];
int main()
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		int n, m, k;
		scanf("%d%d%d", &n, &m, &k);
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &h[i]);
		}
		int num = m;
		bool flag = true;
		for (int i = 1; i < n; i++)
		{
			int number = h[i] - h[i - 1];
			if (number <= k)
			{
				if (k - number >= 0)
					num += (k - number);
				else num += h[i - 1];
			}
			else
			{
				if (num - (number - k) >= 0)
				{
					num -= (number - k);
				}
				else
				{
					flag = false;
					break;
				}
			}
		}
		if (flag) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<cmath>
#include<vector>
#include<string>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define Maxi 1000000
#define INF 0x3f3f3f3f
typedef long long ll;
int h[100];
int main()
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		int n, m, k;
		scanf("%d%d%d", &n, &m, &k);
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &h[i]);
		}
		int num = m;
		bool flag = true;
		for (int i = 1; i < n; i++)
		{
			int number = h[i] - h[i - 1];
			if (number <= k)
			{
				if (k - number <= h[i - 1])
					num += (k - number);
				else num += h[i - 1];
			}
			else
			{
				if (num - (number - k) >= 0)
				{
					num -= (number - k);
				}
				else
				{
					flag = false;
					break;
				}
			}
		}
		if (flag) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int T;
	int N, M, K, c;
	int *h;
	bool yes = true;

	cin >> T;
	for (int t = 0; t < T; t++) {
		cin >> N >> M >> K;
		h = new int[N];
		yes = true;
		c = 0;
		for (int i = 0; i < N; i++) {
			cin >> h[i];
		}

		while (yes && (c < N - 1)) {
			if (h[c] >= h[c + 1] - K) {
				if (h[c] != 0) {
					M = M + (min(h[c] - h[c + 1] + K, h[c]));
				}
			}
			else {
				M = M + (h[c] - h[c + 1] + K);
				if (M < 0) {
					yes = false;
				}
			}
			c++;
		}

		if (yes) {
			cout << "YES" << "\n";
		}
		else {
			cout << "NO" << "\n";
		}

		delete[] h;
	}

}


#include <iostream>
using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int T;
	int N, M, K, c;
	int *h;
	bool yes = true;

	cin >> T;
	for (int t = 0; t < T; t++) {
		cin >> N >> M >> K;
		h = new int[N];
		yes = true;
		c = 0;
		for (int i = 0; i < N; i++) {
			cin >> h[i];
		}

		while (yes && (c < N - 1)) {
			if (h[c] >= h[c + 1] - K) {
				if (h[c] != 0) {
					M = M + (h[c] - h[c + 1] + K);
				}
			}
			else {
				M = M + (h[c] - h[c + 1] + K);
				if (M < 0) {
					yes = false;
				}
			}
			cout << "A" << "\n";
			c++;
		}

		if (yes) {
			cout << "YES" << "\n";
		}
		else {
			cout << "NO" << "\n";
		}

		delete[] h;
	}

}


#include <iostream>
using namespace std;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int T;
	int N, M, K, c;
	int *h;
	bool yes = true;

	cin >> T;
	for (int t = 0; t < T; t++) {
		cin >> N >> M >> K;
		h = new int[N];
		yes = true;
		c = 0;
		for (int i = 0; i < N; i++) {
			cin >> h[i];
		}

		while (yes && (c < N - 1)) {
			if (h[c] >= h[c + 1] - K) {
				if (h[c] != 0) {
					M = M + (h[c] - h[c + 1] + K);
				}
			}
			else {
				M = M + (h[c] - h[c + 1] + K);
				if (M < 0) {
					yes = false;
				}
			}
			c++;
		}

		if (yes) {
			cout << "YES" << "\n";
		}
		else {
			cout << "NO" << "\n";
		}

		delete[] h;
	}

}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;
typedef long long ll;
ll h[105];
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		ll n,bag,k;
		int ok=1;
		scanf("%lld%lld%lld",&n,&bag,&k);
		for(int i=1;i<=n;i++) scanf("%lld",&h[i]);
		for(int i=1;i<n;i++){
			if(h[i+1]>=h[i]){
				if(h[i+1]-h[i]<=k) bag+=(k+h[i]-h[i-1]);
				else{
					if(h[i+1]-h[i]-k<=bag) bag-=(h[i+1]-h[i]-k);
					else{
						printf("NO\n");ok=0;break;
					}
				}
			}
			else bag+=(k+h[i]-h[i+1]);
		}
		if(ok) printf("YES\n");

	}
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;
typedef long long ll;
ll h[105];
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		memset(h,0,sizeof(h));
		ll n,bag,k;
		int ok=1;
		scanf("%lld%lld%lld",&n,&bag,&k);
		for(int i=1;i<=n;i++) scanf("%lld",&h[i]);
		for(int i=1;i<n;i++){
			if(h[i+1]>=h[i]){
				if(h[i+1]-h[i]<=k) bag+=(k+h[i]-h[i-1]);
				else{
					if(h[i+1]-h[i]-k<=bag) bag-=(h[i+1]-h[i]-k);
					else{
						printf("NO\n");ok=0;break;
					}
				}
			}
			else bag+=(k+h[i]-h[i+1]);
		}
		if(ok) printf("YES\n");

	}
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;
typedef long long ll;
ll h[105];
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		memset(h,0,sizeof(h));
		ll n,bag,k;
		int ok=1;
		scanf("%lld%lld%lld",&n,&bag,&k);
		for(int i=1;i<=n;i++) scanf("%lld",&h[i]);
		for(int i=1;i<n;i++){
			if(h[i+1]>=h[i]){
				if(h[i+1]-h[i]<=k) bag+=(k+h[i]-h[i+1]);
				else{
					if(h[i+1]-h[i]-k<=bag) bag-=(h[i+1]-h[i]-k);
					else{
						printf("NO\n");ok=0;break;
					}
				}
			}
			else bag+=min(h[i],k+h[i]-h[i+1]);
		}
		if(ok) printf("YES\n");

	}
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

using namespace std;
typedef long long ll;
ll h[105];
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		memset(h,0,sizeof(h));
		ll n,bag,k;
		int ok=1;
		scanf("%lld%lld%lld",&n,&bag,&k);
		for(int i=1;i<=n;i++) scanf("%lld",&h[i]);
		for(int i=1;i<n;i++){
			if(h[i+1]>=h[i]){
				if(h[i+1]-h[i]<=k) bag+=min(h[i],k+h[i]-h[i+1]);
				else{
					if(h[i+1]-h[i]-k<=bag) bag-=(h[i+1]-h[i]-k);
					else{
						printf("NO\n");ok=0;break;
					}
				}
			//	printf("bag:%lld\n",bag);
			}
			else 	bag+=min(h[i],k+h[i]-h[i+1]);
		}
		if(ok) printf("YES\n");

	}
	return 0;
}