Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Chef's college is conducting an online exam, where his camera will be monitored by one or more invigilators (supervisors). Once again, Chef failed to prepare for the exam on time and decided to google answers during it.

The exam starts at time $0$ and ends at time $F$ minutes. Chef needs a total of $K$ minutes of googling during the exam in order to pass it. There are $N$ invigilators (numbered $1$ through $N$); for each valid $i$, the $i$-th invigilator monitors Chef's camera during the time interval starting at $S_{i}$ minutes since the start of the exam and ending at $E_{i}$ minutes (where $0 ≤ S_{i} ≤ E_{i} ≤ F$). He was resourceful enough to somehow get hold of these times and now he wants to know if he would be able to pass the exam if he googles the answers during the times when no one is looking at his camera.

Note: The time of googling need not be continuous and there can be multiple invigilators at some interval of time.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains three space-separated integers $N$, $K$ and $F$.
$N$ lines follow. For each valid $i$, the $i$-th of these lines contains two space-separated integers $S_{i}$ and $E_{i}$.

------  Output ------
For each test case, print a single line containing the string "YES" if it is possible to pass the exam or "NO" if it is impossible.

You may print each character of each string in uppercase or lowercase (for example, the strings "yEs", "yes", "Yes" and "YES" will all be treated as identical).

------  Constraints ------
$1 ≤ T ≤ 10^{5}$
$1 ≤ N ≤ 10^{5}$
$1 ≤ F ≤ 10^{9}$
$0 ≤ K ≤ F$
$0 ≤ S_{i} ≤ E_{i} ≤ F$ for each valid $i$
the sum of $N$ over all test cases does not exceed $2 \cdot 10^{5}$

----- Sample Input 1 ------ 
3
1 10 10
0 10
2 2 10
0 5
7 10
2 2 100
0 5
5 10
----- Sample Output 1 ------ 
NO
YES
YES
----- explanation 1 ------ 
Example case 1: There is no point during the exam when Chef is not monitored, so he is unable to google even for a single second and will fail the exam.

Example case 2: Chef can google for $2$ minutes (in the time interval $[5, 7]$, when he is not monitored) and hence will be able to pass the exam.

Example case 3: Chef can google for $2$ minutes (in the time interval $[10, 12]$) and hence will be able to pass the exam.

Difficulty: MEDIUM_HARD

Solutions:
t = int(input())
for i in range(t):
	(n, k, f) = map(int, input().split())
	l = []
	for j in range(n):
		(a, b) = map(int, input().split())
		l.append((a, b))
	l.sort()
	(a, b) = l[0]
	if a > 0:
		ans += a
	else:
		ans = 0
	s = b
	for x in range(1, n):
		(a, b) = l[x]
		if a >= s:
			ans += a - s
		if s < b:
			s = b
	if s < f:
		ans += f - s
	if ans >= k:
		print('YES')
	else:
		print('NO')


T = int(input())
for _ in range(T):
	(n, k, f) = map(int, input().split())
	L = []
	for i in range(n):
		(a, b) = map(int, input().split())
		L.append((a, b))
	L.sort()
	(a, b) = L[0]
	if a > 0:
		ans += a
	else:
		ans = 0
	end = b
	for i in range(1, n):
		(a, b) = L[i]
		if a >= end:
			ans += a - end
		if end < b:
			end = b
	if end < f:
		ans += f - end
	if ans >= k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k, f) = (int(i) for i in input().split())
	a = []
	for i in range(n):
		a.append([int(x) for x in input().split()])
	a.sort()
	diff = a[0][0]
	end = a[0][-1]
	for i in range(1, n):
		diff += max(0, a[i][0] - end)
		end = max(end, a[i][-1])
	diff += f - end
	if diff >= k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k, f) = (int(i) for i in input().split())
	l = []
	for i in range(n):
		l.append(tuple(map(int, input().split())))
	l = sorted(l, key=lambda x: x[0])
	end = l[0][1]
	time = l[0][0]
	for i in range(1, n):
		if l[i][0] >= end:
			time += l[i][0] - end
		end = max(end, l[i][1])
	time += f - end
	if time >= k:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k, f) = map(int, input().split())
	l = []
	for i in range(n):
		(s, e) = map(int, input().split())
		l.append((s, e))
	l.sort()
	stack = [(0, 0)]
	for i in l:
		if stack[-1][1] < i[0]:
			stack.append(i)
		if stack[-1][1] > i[0]:
			if stack[-1][1] >= i[1]:
				continue
			else:
				stack[-1] = (stack[-1][0], i[1])
		if stack[-1][1] == i[0]:
			stack[-1] = (stack[-1][0], i[1])
	c = 0
	for i in stack:
		c += i[1] - i[0]
	diff = f - c
	if diff < k:
		print('NO')
	else:
		print('YES')


for i in range(int(input())):
	(n, k, f) = map(int, input().split())
	arr = []
	for i in range(n):
		arr.append(list(map(int, input().split())))
	arr.sort(key=lambda x: x[0])
	sub = arr[0][0]
	mx = arr[0][1]
	for i in range(1, len(arr)):
		if mx < arr[i][0]:
			sub += arr[i][0] - mx
			mx = arr[i][1]
		else:
			mx = max(mx, arr[i][1])
	if mx < f:
		sub += f - mx
	if sub >= k:
		print('YES')
	else:
		print('NO')


for u in range(int(input())):
	(n, k, f) = map(int, input().split())
	x = []
	for i in range(n):
		(a, b) = map(int, input().split())
		x.append([a, b])
	x = sorted(x)
	y = [x[0]]
	for i in range(1, n):
		if x[i - 1][1] > x[i][0]:
			y[-1][1] = max(x[i][1], x[i - 1][1])
		else:
			y.append(x[i])
	time = 0
	for i in range(len(y)):
		time += y[i][1] - y[i][0]
	time = f - time
	if time >= k:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(N, K, F) = map(int, input().split())
	times = []
	for _ in range(N):
		(start, end) = map(int, input().split())
		times.append((start, 'a'))
		times.append((end, 'b'))
	times.sort()
	prev = 0
	count = 0
	total = 0
	for (i, item) in enumerate(times):
		if count == 0:
			total += item[0] - prev
		if item[1] == 'a':
			count += 1
		else:
			count -= 1
			prev = item[0]
	total += F - prev
	if total >= K:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(n, k, f) = list(map(int, input().split()))
	dif = 0
	max_inv_p = 0
	total_ct = 0
	arr = []
	for j in range(n):
		(s, e) = map(int, input().split())
		arr.append([s, e])
	arr.sort()
	for (s, e) in arr:
		if s >= max_inv_p:
			diff = s - max_inv_p
			total_ct += diff
		if e > max_inv_p:
			max_inv_p = e
	diff = f - max_inv_p
	total_ct += diff
	if total_ct >= k:
		print('YES')
	else:
		print('NO')


def final(arr):
	if len(arr) == 0:
		return []
	arr.sort()
	temp = []
	temp.append(arr[0])
	for i in range(1, len(arr)):
		last_element = temp[len(temp) - 1]
		if last_element[1] >= arr[i][0]:
			last_element[1] = max(arr[i][1], last_element[1])
			temp.pop(len(temp) - 1)
			temp.append(last_element)
		else:
			temp.append(arr[i])
	return temp
for i in range(int(input())):
	(n, k, f) = [int(x) for x in input().split()]
	arr1 = []
	cnt = 0
	for i in range(n):
		i = [int(x) for x in input().split()]
		arr1.append(i)
	looking = final(arr1)
	for i in range(len(looking)):
		cnt += looking[i][1] - looking[i][0]
	if f - cnt >= k:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k, f) = map(int, input().split())
	a = []
	for i in range(n):
		x = list(map(int, input().split()))
		a.append(x)
	a.sort()
	fl = []
	s = a[0][0]
	e = a[0][1]
	for (x, y) in a:
		if x <= e:
			e = max(y, e)
		else:
			fl.append([s, e])
			s = x
			e = y
	fl.append([s, e])
	ans = f
	for (x, y) in fl:
		ans -= y - x
	if ans >= k:
		print('YES')
	else:
		print('NO')


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, k, f) = map(int, sys.stdin.readline().split())
	l = [tuple(map(int, sys.stdin.readline().split())) for i in range(n)]
	l.sort()
	c = 0
	for i in range(n):
		if i == 0:
			c += l[i][1] - l[i][0]
			z = l[i][1]
		elif l[i][0] >= z:
			c += l[i][1] - l[i][0]
			z = l[i][1]
		else:
			d = l[i][1] - z
			if d > 0:
				c += d
				z = l[i][1]
	ans = f - c
	if ans >= k:
		print('YES')
	else:
		print('NO')


import numpy as np
for _ in range(int(input())):
	(n, k, f) = map(int, input().split())
	c = []
	for i in range(n):
		(a, b) = map(int, input().split())
		c.append((a, b))
	c.sort(key=lambda x: x[0])
	s = c[0][0] - 0
	maxi = c[0][1]
	for i in range(1, len(c)):
		if maxi < c[i][1]:
			s += max(0, c[i][0] - maxi)
			maxi = c[i][1]
	s += f - maxi
	if s >= k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k, f) = map(int, input().split())
	count = 0
	l = []
	for _ in range(n):
		temp = list(map(int, input().split()))
		l.append(temp)
	l.sort()
	for i in range(n):
		if i == 0:
			count += l[i][1] - l[i][0]
			z = l[i][1]
		elif l[i][0] >= z:
			count += l[i][1] - l[i][0]
			z = l[i][1]
		else:
			t = l[i][1] - z
			if t > 0:
				count += t
				z = l[i][1]
	net = f - count
	if net >= k:
		print('YES')
	else:
		print('NO')


def ctime(n, k, f, l):
	l.sort()
	(ans, max_end) = (0, l[0][1])
	for i in range(1, n):
		ans += max(0, l[i][0] - max_end)
		max_end = max(max_end, l[i][1])
	ans += l[0][0]
	ans += f - max_end
	return ans
t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	(n, k, f) = (l[0], l[1], l[2])
	arr = []
	for i in range(n):
		l = list(map(int, input().split()))
		arr.append(l)
	ans = ctime(n, k, f, arr)
	if ans >= k:
		print('YES')
	else:
		print('NO')


def solve():
	(n, k, f) = map(int, input().split())
	s = []
	e = []
	for i in range(n):
		(a, b) = map(int, input().split())
		s.append(a)
		e.append(b)
	s.sort()
	e.sort()
	ans = 0
	max_end = e[0]
	for i in range(n):
		ans += max(0, s[i] - max_end)
		max_end = max(max_end, e[i])
	ans += s[0]
	ans += f - max_end
	if ans >= k:
		print('YES')
	else:
		print('NO')
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	(n, k, f) = map(int, input().split())
	time = []
	for i in range(n):
		(s, e) = map(int, input().split())
		time.append([s, e])
	time.sort(key=lambda x: x[0])
	ch = 0
	comp = 0
	for i in time:
		if i[0] > comp:
			ch = ch + (i[0] - comp)
		else:
			ch += 0
		comp = max(comp, i[1])
	if comp < f:
		ch = ch + (f - comp)
	if ch >= k:
		print('YES')
	else:
		print('NO')


import sys

def solve(time_schedule, n, f, k):
	time_schedule.sort()
	answer = 0
	max_end = time_schedule[0][1]
	for i in range(1, n):
		answer += max(0, time_schedule[i][0] - max_end)
		max_end = max(max_end, time_schedule[i][1])
	answer += time_schedule[0][0] + (f - max_end)
	if answer >= k:
		return 'YES'
	else:
		return 'NO'
vaibhav = sys.stdin.readline
for _ in range(int(vaibhav())):
	(n, k, f) = map(int, vaibhav().split())
	time_schedule = [0] * n
	for i in range(n):
		time_schedule[i] = tuple(map(int, vaibhav().split()))
	result = solve(time_schedule, n, f, k)
	print(result)


t = int(input())
while t:
	a = list(map(int, input().split()))
	n = a[0]
	k = a[1]
	f = a[2]
	time = 0
	p = 0
	arr = []
	for i in range(n):
		(s1, e1) = map(int, input().split())
		arr.append([s1, e1])
	arr = sorted(arr)
	for i in range(n):
		s = arr[i][0]
		if s - p > 0:
			time += s - p
		e = arr[i][1]
		p = max(p, e)
	if e < f:
		time += f - p
	if time >= k:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for test in range(t):
	(n, k, f) = map(int, input().split())
	l = []
	for i in range(n):
		l.append(list(map(int, input().split())))
	l.sort()
	c = 0
	for i in range(n):
		if i == 0:
			c += l[i][1] - l[i][0]
			z = l[i][1]
		elif l[i][0] >= z:
			c += l[i][1] - l[i][0]
			z = l[i][1]
		else:
			y = l[i][1] - z
			if y > 0:
				c += y
				z = l[i][1]
	x = f - c
	if x >= k:
		print('YES')
	else:
		print('NO')


from math import *
R = lambda : list(map(int, input().split()))
MOD = 1000000007
for _ in range(int(input())):
	(n, k, f) = R()
	arr = [(0, 0)]
	for i in range(n):
		(s, e) = R()
		arr.append((s, e))
	arr.append((f, f))
	arr.sort(key=lambda x: x[0])
	t = 0
	endtime = 0
	for i in range(1, len(arr)):
		if endtime < arr[i][0]:
			t += arr[i][0] - endtime
		endtime = max(endtime, arr[i][1])
	if t >= k:
		print('YES')
	else:
		print('NO')


for __ in range(int(input())):
	(n, k, f) = map(int, input().split())
	intervals = []
	for i in range(n):
		(s, e) = map(int, input().split())
		intervals.append([s, e])
	intervals = sorted(intervals)
	new_intervals = [intervals[0]]
	for i in range(1, n):
		if intervals[i][0] <= new_intervals[-1][1]:
			new_intervals[-1][1] = max(new_intervals[-1][1], intervals[i][1])
		else:
			new_intervals.append(intervals[i])
	free_time = f
	for interval in new_intervals:
		free_time -= interval[1] - interval[0]
	if free_time >= k:
		print('YES')
	else:
		print('NO')


def solve():
	(n, k, f) = map(int, input().split())
	arr = []
	for i in range(n):
		arr.append(list(map(int, input().split())))
	arr.sort()
	start = end = interval = prev = duration = 0
	for i in arr:
		start = i[0]
		end = i[1]
		if prev > start:
			start = prev
		duration += max(0, end - start)
		prev = max(prev, end)
	if f - duration >= k:
		print('YES')
	else:
		print('NO')
t = int(input())
for _ in range(t):
	solve()


def get_list():
	return list(map(int, input().split()))
for t in range(int(input())):
	(n, k, f) = get_list()
	intervals = []
	for i in range(n):
		se = get_list()
		intervals.append(se)
	intervals.sort()
	pb = 0
	kcount = 0
	for (a, b) in intervals:
		if a > pb:
			kcount += a - pb
		pb = max(pb, b)
	if f > pb:
		kcount += f - pb
	if kcount >= k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k, f) = tuple(map(int, input().split()))
	tuples = []
	for i in range(n):
		tuples.append(tuple(map(int, input().split())))
	tuples.sort()
	(s, e) = tuples[0]
	CheatingTime = s
	for i in range(1, n):
		if e >= tuples[i][0]:
			e = max(e, tuples[i][1])
		else:
			CheatingTime += tuples[i][0] - e
			if CheatingTime >= k:
				print('YES')
				break
			(s, e) = tuples[i]
	else:
		CheatingTime += f - e
		if CheatingTime >= k:
			print('YES')
		else:
			print('NO')


t = int(input())
n = [0 for x in range(t)]
k = [0 for x in range(t)]
f = [0 for x in range(t)]
se = [[] for x in range(t)]
for i in range(t):
	(n[i], k[i], f[i]) = map(int, input().split())
	for v in range(n[i]):
		se[i].append(list(map(int, input().split())))
for i in range(t):
	startingPoint = 0
	requiredTime = k[i]
	totalTime = f[i]
	currTP = se[i]
	invgTime = 0
	invSt = []
	invEn = []
	for tp in range(n[i]):
		invSt.append(currTP[tp][0])
		invEn.append(currTP[tp][1])
	idxSort = [i for i in range(n[i])]
	idxSort.sort(key=lambda x: invSt[x])
	invSt.sort()
	invgEnding = [0 for i in range(n[i])]
	for s in range(n[i]):
		invgEnding[s] = invEn[idxSort[s]]
	prevSt = 0
	prevEn = 0
	for p in range(n[i]):
		if invgEnding[p] <= prevEn:
			continue
		if invSt[p] >= prevEn:
			invgTime += abs(invSt[p] - invgEnding[p])
		elif invSt[p] < prevEn:
			invgTime += abs(invgEnding[p] - prevEn)
		prevSt = invSt[p]
		prevEn = invgEnding[p]
	if totalTime - invgTime >= requiredTime:
		print('YES')
	else:
		print('NO')


cases = int(input())
for _ in range(cases):
	(n, k, f) = map(int, input().split())
	time = []
	for x in range(n):
		arr = list(map(int, input().split()))
		time.append(arr)
	time.append([f, f])
	time.sort()
	mn = 0
	mx = 0
	avail = 0
	for (i, j) in time:
		if i > mx:
			avail += i - mx
		mx = max(mx, j)
	if avail >= k:
		print('YES')
	else:
		print('NO')


def solve(l, k, f):
	l.sort(key=lambda x: x[0])
	tot = l[0][0]
	if tot >= k:
		return True
	maxx = l[0][1]
	for i in range(len(l)):
		if l[i][0] > maxx:
			tot += l[i][0] - maxx
		maxx = max(l[i][1], maxx)
	tot += f - maxx
	return tot >= k
t = int(input())
for tc in range(t):
	inp = list(map(int, input().split()))
	(n, k, f) = (inp[0], inp[1], inp[2])
	l = []
	for i in range(n):
		l.append(list(map(int, input().split())))
	if solve(l, k, f):
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k, t) = map(int, input().split())
	l = []
	for i in range(n):
		(a, b) = map(int, input().split())
		l.append([a, b])
	l.sort()
	s = l[0][0]
	e = l[0][1]
	for j in range(len(l) - 1):
		if l[j + 1][0] <= e:
			if l[j + 1][1] > e:
				e = l[j + 1][1]
			else:
				None
		else:
			t = t - (e - s)
			s = l[j + 1][0]
			e = l[j + 1][1]
	t = t - (e - s)
	if t >= k:
		print('YES')
	elif k == 0:
		print('YES')
	elif t < k:
		print('NO')


for _ in range(int(input())):
	(n, k, f) = map(int, input().split())
	l = [[0, 0]]
	for i in range(n):
		(s, e) = map(int, input().split())
		l.append([s, e])
	l.append([f, f])
	l = sorted(l)
	mx = 0
	total = 0
	length = len(l)
	for i in range(length - 1):
		if l[i][1] > mx:
			mx = l[i][1]
		if l[i + 1][0] > mx:
			total += l[i + 1][0] - mx
	if total >= k:
		print('YES')
	else:
		print('NO')


t = int(input())
for trash in range(t):
	(n, k, f) = [int(i) for i in input().split()]
	x = 0
	l = []
	for j in range(n):
		l.append(list(map(int, input().split())))
	l.sort()
	for i in range(n):
		(s, e) = [int(q) for q in l[i]]
		if s >= x:
			dur = e - s
			f = f - dur
			x = e
		else:
			f = f - max(0, e - x)
			x = max(x, e)
	if f >= k:
		print('YES')
	else:
		print('NO')


from collections import defaultdict, Counter
from sys import stdin, stdout, setrecursionlimit
from math import *
from bisect import bisect_left

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

def ari():
	return list(map(int, I().split()))

def ars():
	return list(map(str, I().split()))

def arf():
	return list(map(float, I().split()))

def mpi():
	return map(int, I().split())

def mps():
	return map(str, I().split())

def mpf():
	return map(float, I().split())
mod = 10 ** 9 + 7
setrecursionlimit(10 ** 8)
inf = float('inf')

def power(A, B, p):
	res = 1
	A = A % p
	if A == 0:
		return 0
	while B > 0:
		if B & 1 == 1:
			res = res * A % p
		B = B >> 1
		A = A * A % p
	return res

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, ceil(sqrt(n)) + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def func():
	if K > F:
		return 'NO'
	tmg.sort()
	c = 0
	st = tmg[0][0]
	et = tmg[0][1]
	c += st
	for i in range(1, len(tmg)):
		c += max(tmg[i][0] - et, 0)
		et = max(tmg[i][1], et)
	c += F - et
	if c >= K:
		return 'YES'
	return 'NO'
for t in range(int(I())):
	(N, K, F) = mpi()
	tmg = []
	for i in range(N):
		(s, e) = mpi()
		tmg.append([s, e])
	print(func())


t = int(input())
for i in range(t):
	l = []
	(n, k, f) = map(int, input().split())
	for i in range(n):
		(s, e) = map(int, input().split())
		l.append((s, e))
	l.sort()
	a = l[0][0]
	mx = l[0][1]
	af = l[0][0]
	ak = l[0][1]
	for i in range(1, len(l)):
		x = l[i][0]
		y = l[i][1]
		a += max(0, x - mx)
		mx = max(mx, y)
	a += f - mx
	if a >= k:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in [0] * t:
	(n, k, f) = list(map(int, input().split()))
	times = []
	for i in range(n):
		times.append(list(map(int, input().split())))
	times.sort()
	i = 0
	while i < len(times) - 2 and len(times) > 1:
		try:
			if times[i][1] >= times[i + 1][0]:
				s_new = min(times[i][0], times[i + 1][0])
				f_new = max(times[i][1], times[i + 1][1])
				times.pop(i + 1)
				times[i] = [s_new, f_new]
			else:
				i += 1
		except:
			print(f'i: {i} len: {len(times)}')
			break
	time_point = 0
	total_time = 0
	for time in times:
		start = time[0]
		finish = time[1]
		if time_point <= start:
			total_time += finish - start
		elif time_point < finish:
			total_time += finish - time_point
		time_point = finish
	if f - total_time < k:
		print('NO')
	else:
		print('YES')


t = int(input())
for _ in range(t):
	(n, k, f) = map(int, input().split())
	x = []
	for i in range(n):
		se = list(map(int, input().split()))
		x.append(se)
	x.sort()
	ans = 0
	p = 0
	for y in x:
		ans += max(0, y[0] - p)
		p = max(p, y[1])
	ans += max(0, f - p)
	if ans >= k:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k, f) = input().split()
	n = int(n)
	k = int(k)
	f = int(f)
	arr = []
	for _ in range(n):
		(x, y) = input().split()
		arr.append([int(x), int(y)])
	arr.sort(key=lambda x: x[0:1])
	x1 = arr[0][0]
	y1 = arr[0][1]
	ans = []
	for (x2, y2) in arr[1:]:
		if y1 >= x2:
			y1 = max(y1, y2)
		else:
			ans.append([x1, y1])
			x1 = x2
			y1 = y2
	if [x1, y1] not in ans:
		ans.append([x1, y1])
	for (x1, y1) in ans:
		f -= y1 - x1
	if f >= k:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(n, k, f) = map(int, input().split())
	mtime = 0
	tot = 0
	arr = []
	for i in range(n):
		(l, r) = map(int, input().split())
		arr.append([l, r])
	arr.sort()
	for (s, e) in arr:
		if s >= mtime:
			diff = s - mtime
			tot += diff
		if e > mtime:
			mtime = e
	tot += f - mtime
	if tot >= k:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	(n, k, f) = [int(i) for i in input().split()]
	l = []
	for i in range(n):
		q = [int(i) for i in input().split()]
		l.append(q)
	l.sort()
	ans = 0
	max_end = l[0][1]
	for i in range(1, n):
		ans += max(0, l[i][0] - max_end)
		max_end = max(max_end, l[i][1])
	ans += abs(f - max_end)
	ans += l[0][0]
	if ans >= k:
		print('YES')
	else:
		print('NO')
	t -= 1


from sys import stdin, stdout
from math import ceil, floor, sqrt, log, log2, log10
from collections import Counter
input = stdin.readline
t = int(input())

def solve():
	pass
for _ in range(t):
	(n, k, f) = map(int, input().split())
	inv = []
	for i in range(n):
		(a, b) = map(int, input().split())
		inv.append((a, b))
	inv.sort()
	currStart = 0
	currEnd = 0
	for i in range(n):
		(a, b) = inv[i]
		if a > currEnd:
			k -= a - currEnd
			currStart = a
		currEnd = max(b, currEnd)
		if k <= 0:
			break
	k -= f - currEnd
	print('YES' if k <= 0 else 'NO')


t = int(input())
for _ in range(t):
	(n, k, f) = input().split()
	(n, k, f) = (int(n), int(k), int(f))
	tg = 0
	time = 0
	sa = []
	ea = []
	for j in range(n):
		(s, e) = input().split()
		(s, e) = (int(s), int(e))
		sa.append(s)
		ea.append(e)
	sa.sort()
	ea.sort()
	time = 0
	tg = 0
	for i in range(len(sa)):
		s = sa[i]
		e = ea[i]
		if s > time:
			tg = tg + (s - time)
			time = e
		else:
			time = e
	tg = tg + (f - time)
	if tg >= k:
		print('YES')
	else:
		print('NO')


from sys import stdin
for _ in range(int(stdin.readline())):
	(n, k, f) = map(int, stdin.readline().split())
	lis = [[*map(int, stdin.readline().split())] for kk in range(n)]
	lis.sort()
	end = lis[0][1]
	ans = lis[0][0]
	for (s, e) in lis:
		if s > end:
			ans += s - end
			end = e
		elif e > end:
			end = e
	ans += f - end
	print('YES') if ans >= k else print('NO')


def ctime(k, f, l):
	first = l.pop(0)
	s = first[0]
	e = first[1]
	t = s
	for x in l:
		if x[0] < e:
			e = max(e, x[1])
		else:
			s = x[0]
			t += s - e
			e = x[1]
	t += f - e
	if t >= k:
		return 'YES'
	else:
		return 'NO'
t = int(input())
for _ in range(t):
	(n, k, f) = map(int, input().rstrip().rsplit())
	l = []
	for __ in range(n):
		pair = list(map(int, input().rstrip().rsplit()))
		l.append(pair)
	l.sort(key=lambda x: x[0])
	res = ctime(k, f, l)
	print(res)


t = int(input())
for i in range(t):
	(n, k, f) = [int(x) for x in input().split()]
	nums = []
	for i in range(n):
		(si, fi) = [int(x) for x in input().split()]
		nums.append([si, fi])
	nums.sort()
	res = []
	res.append(nums[0])
	for i in range(1, len(nums)):
		if nums[i][0] <= res[-1][1]:
			res[-1][1] = max(nums[i][1], res[-1][1])
		else:
			res.append(nums[i])
	t = 0
	for (st, fin) in res:
		t += fin - st
	if f - t >= k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	nkf = list(map(int, input().split()))
	(n, k, f) = (nkf[0], nkf[1], nkf[2])
	timing = [[0, 0]] * n
	for i in range(n):
		timing[i] = list(map(int, input().split()))
	timing.sort()
	currK = timing[0][0]
	currF = timing[0][1]
	for sets in range(1, n):
		if timing[sets][0] > currF:
			currK += timing[sets][0] - currF
		currF = max(currF, timing[sets][1])
	currK += f - currF
	if currK >= k:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	l = []
	for i in range(a):
		(n, m) = map(int, input().split())
		l.append([n, m])
	l.sort()
	d = l[0][1] - l[0][0]
	ma = l[0][1]
	(p, k) = (0, 0)
	for i in range(1, a):
		k = 1
		if l[i][0] >= ma:
			d += l[i][1] - l[i][0]
			ma = l[i][1]
		elif l[i][0] < ma:
			if l[i][1] > ma:
				d += l[i][1] - ma
				ma = l[i][1]
		if c - d < b:
			p = 1
			break
	if k == 1 and p == 1:
		print('NO')
	elif k == 1 and p == 0:
		print('YES')
	elif k == 0:
		if c - d < b:
			print('NO')
		else:
			print('YES')


import collections
for _ in range(int(input())):
	dee = collections.deque()
	(n, k, f) = map(int, input().split())
	ans = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		dee.appendleft([a, b])
	de = sorted(dee)
	x = de[0][0]
	y = de[0][1]
	ans = ans + de[0][0]
	for i in range(1, n):
		if de[i][0] > y:
			ans += de[i][0] - y
			y = max(y, de[i][1])
		else:
			y = max(y, de[i][1])
	ans += f - y
	if ans >= k:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(n, k, f) = map(int, input().split())
	lst = []
	for i in range(n):
		lst.append(list(map(int, input().split())))
	lst.sort()
	ans = lst[0][0]
	end = lst[0][1]
	for i in range(1, n):
		ans += max(0, lst[i][0] - end)
		end = max(end, lst[i][1])
	ans += f - end
	if ans < k:
		print('NO')
	else:
		print('YES')


for dcfvgbnjm in range(int(input())):
	(n, k, f) = list(map(int, input().split()))
	d = []
	for i in range(n):
		se = list(map(int, input().split()))
		d.append(se)
	d.sort(key=lambda list: list[0])
	end = -1
	count = 0
	test = False
	ans = 0
	while count < len(d):
		if d[count][0] > end:
			ans += d[count][1] - d[count][0]
		elif d[count][1] > end:
			ans += d[count][1] - end
		end = max(end, d[count][1])
		count += 1
	if f - ans >= k:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k, f) = map(int, input().split())
	l = []
	for i in range(n):
		l.append(tuple(map(int, input().split())))
	l.sort()
	ans = 0
	me = l[0][1]
	for i in range(1, n):
		ans += max(0, l[i][0] - me)
		me = max(me, l[i][1])
	ans += l[0][0]
	ans += f - me
	if ans < k:
		print('NO')
	else:
		print('YES')


try:
	t = int(input())
	while t > 0:
		(n, k, f) = map(int, input().split())
		l = []
		for _ in range(n):
			l.append(list(map(int, input().split())))
		l.sort()
		time = 0
		right = l[0][1]
		for i in range(1, n):
			time += max(0, l[i][0] - right)
			right = max(right, l[i][1])
		time += l[0][0]
		time += f - right
		if time >= k:
			print('YES')
		else:
			print('NO')
		t -= 1
except:
	pass


t = int(input())
while t > 0:
	(n, k, f) = map(int, input().split(' '))
	timeslots = list()
	for _ in range(n):
		timeslots.append(list(map(int, input().split(' '))))
	timeslots.sort()
	totalFreetime = timeslots[0][0]
	maxEnd = timeslots[0][1]
	for i in range(1, n):
		if timeslots[i][0] > maxEnd:
			totalFreetime += timeslots[i][0] - maxEnd
		maxEnd = max(maxEnd, timeslots[i][1])
	totalFreetime += f - maxEnd
	print('YES') if totalFreetime >= k else print('NO')
	t -= 1


t = int(input())
while t:
	(n, k, f) = map(int, input().split())
	l = []
	for i in range(n):
		x = list(map(int, input().split()))
		l.append(x)
	l = sorted(l)
	ans = l[0][0]
	max_until = l[0][1]
	for i in range(1, n):
		ans += max(0, l[i][0] - max_until)
		max_until = max(max_until, l[i][1])
	ans += f - max_until
	if ans >= k:
		print('YES')
	else:
		print('NO')
	t -= 1


for _ in range(int(input())):
	(N, K, F) = map(int, input().split())
	arr = []
	flag = True
	ml = False
	mr = 0
	while N:
		N -= 1
		(s, e) = map(int, input().split())
		arr.append((s, e))
		if flag:
			ml = s
			flag = False
		else:
			ml = min(ml, s)
		mr = max(e, mr)
	arr.sort(key=lambda x: x[1])
	tot = ml + F - mr
	for i in range(len(arr) - 1):
		if arr[i][1] < arr[i + 1][0]:
			tot += arr[i + 1][0] - arr[i][1]
	if tot >= K:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(n, k, f) = map(int, input().split())
	times = []
	for j in range(n):
		(s, e) = map(int, input().split())
		times.append((s, e))
	times = sorted(times)
	ed1 = times[0][1]
	ans = 0
	for i in range(1, n):
		ans += max(0, times[i][0] - ed1)
		ed1 = max(ed1, times[i][1])
	ans += times[0][0]
	ans += f - ed1
	if ans >= k:
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(n, k, f) = map(int, input().split())
	l = []
	for i in range(n):
		l.append(list(map(int, input().split())))
	l.sort()
	sum = 0
	start = 0
	for i in range(n):
		if start >= l[i][0]:
			start = max(start, l[i][1])
		else:
			sum += l[i][0] - start
			start = l[i][1]
		if sum >= k:
			break
	sum = sum + f - max(start, l[-1][1])
	if sum >= k:
		print('YES')
	else:
		print('NO')


def process():
	(n, k, f) = map(int, input().split())
	data = [tuple(map(int, input().split())) for i in range(n)]
	data.sort(key=lambda x: x[0])
	maxend = 0
	time = 0
	for tup in data:
		(start, end) = tup
		time += max(0, start - maxend)
		maxend = max(maxend, end)
	time += f - maxend
	return 'NO' if time < k else 'YES'
try:
	for t in range(int(input())):
		print(process())
except:
	pass


from collections import Counter
for _ in range(int(input())):
	(n, k, f) = input().split()
	(n, k, f) = (int(n), int(k), int(f))
	nums = []
	for _ in range(n):
		(a, b) = input().split()
		(a, b) = (int(a), int(b))
		nums.append([a, b])
	nums.sort()
	stack = [nums[0]]
	for i in nums[1:]:
		if i[0] <= stack[-1][1]:
			stack[-1][1] = max(i[1], stack[-1][1])
		else:
			stack.append(i)
	spare_time = 0
	spare_time += stack[0][0]
	spare_time += f - stack[-1][1]
	for i in range(len(stack) - 1):
		spare_time += stack[i + 1][0] - stack[i][1]
	if spare_time >= k:
		print('YES')
	else:
		print('NO')


def solve():
	(n, k, f) = list(map(int, input().split()))
	lst = []
	for _ in range(n):
		lst.append(list(map(int, input().split())))
	lst = sorted(lst, key=lambda x: x[0])
	time = lst[0][0]
	finish = lst[0][1]
	for (s, e) in lst:
		if s > finish:
			time += s - finish
		finish = max(finish, e)
	time += f - finish
	if time >= k:
		return 'YES'
	return 'NO'
t = int(input())
for _ in range(t):
	ans = solve()
	print(ans)


for _ in range(int(input())):
	(n, k, f) = list(map(int, input().split()))
	p = 0
	tot = 0
	ar = []
	for i in range(n):
		(s, e) = map(int, input().split())
		ar.append([s, e])
	ar.sort()
	for (s, e) in ar:
		if s >= p:
			dif = s - p
			tot += dif
		if e > p:
			p = e
	dif = f - p
	tot += dif
	if k <= tot:
		print('YES')
	else:
		print('NO')


def merge(intervals):
	l = []
	i = 0
	start = -1
	intervals.sort()
	while i < len(intervals):
		if start == -1:
			start = intervals[i][0]
			end = intervals[i][1]
		else:
			(s, e) = intervals[i]
			if s <= end:
				end = max(end, e)
			else:
				l.append([start, end])
				start = s
				end = e
		i += 1
	l.append([start, end])
	return l

def solve():
	(n, k, f) = [int(x) for x in input().split()]
	merged = []
	for i in range(n):
		interval = [int(x) for x in input().split()]
		merged.append(interval)
	merged = merge(merged)
	c = 0
	for i in range(len(merged) - 1):
		c += merged[i + 1][0] - merged[i][1]
	c = c + (merged[0][0] - 0)
	c = c + (f - merged[-1][1])
	if c >= k:
		print('YES')
	else:
		print('NO')
n = int(input())
while n > 0:
	solve()
	n -= 1


for _ in range(int(input())):
	(n, k, f) = map(int, input().split())
	seq = sorted({tuple(map(int, input().split())) for _ in range(n)})
	(t, m) = (0, 0)
	for i in seq:
		(si, ei) = i
		if si > m:
			t += si - m
		if ei > m:
			m = ei
	t += f - m if f > m else 0
	print('YES' if t >= k else 'NO')