The only difference between easy and hard versions is on constraints. In this version constraints are lower. You can make hacks only if all versions of the problem are solved.

Koa the Koala is at the beach!

The beach consists (from left to right) of a shore, $n+1$ meters of sea and an island at $n+1$ meters from the shore.

She measured the depth of the sea at $1, 2, \dots, n$ meters from the shore and saved them in array $d$. $d_i$ denotes the depth of the sea at $i$ meters from the shore for $1 \le i \le n$.

Like any beach this one has tide, the intensity of the tide is measured by parameter $k$ and affects all depths from the beginning at time $t=0$ in the following way:

  For a total of $k$ seconds, each second, tide increases all depths by $1$.

  Then, for a total of $k$ seconds, each second, tide decreases all depths by $1$.

  This process repeats again and again (ie. depths increase for $k$ seconds then decrease for $k$ seconds and so on ...).

Formally, let's define $0$-indexed array $p = [0, 1, 2, \ldots, k - 2, k - 1, k, k - 1, k - 2, \ldots, 2, 1]$ of length $2k$. At time $t$ ($0 \le t$) depth at $i$ meters from the shore equals $d_i + p[t \bmod 2k]$ ($t \bmod 2k$ denotes the remainder of the division of $t$ by $2k$). Note that the changes occur instantaneously after each second, see the notes for better understanding. 

At time $t=0$ Koa is standing at the shore and wants to get to the island. Suppose that at some time $t$ ($0 \le t$) she is at $x$ ($0 \le x \le n$) meters from the shore:

  In one second Koa can swim $1$ meter further from the shore ($x$ changes to $x+1$) or not swim at all ($x$ stays the same), in both cases $t$ changes to $t+1$.

  As Koa is a bad swimmer, the depth of the sea at the point where she is can't exceed $l$ at integer points of time (or she will drown). More formally, if Koa is at $x$ ($1 \le x \le n$) meters from the shore at the moment $t$ (for some integer $t\ge 0$), the depth of the sea at this point  — $d_x + p[t \bmod 2k]$  — can't exceed $l$. In other words, $d_x + p[t \bmod 2k] \le l$ must hold always.

  Once Koa reaches the island at $n+1$ meters from the shore, she stops and can rest.

Note that while Koa swims tide doesn't have effect on her (ie. she can't drown while swimming). Note that Koa can choose to stay on the shore for as long as she needs and neither the shore or the island are affected by the tide (they are solid ground and she won't drown there). 

Koa wants to know whether she can go from the shore to the island. Help her!


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 100$)  — the number of test cases. Description of the test cases follows.

The first line of each test case contains three integers $n$, $k$ and $l$ ($1 \le n \le 100; 1 \le k \le 100; 1 \le l \le 100$) — the number of meters of sea Koa measured and parameters $k$ and $l$.

The second line of each test case contains $n$ integers $d_1, d_2, \ldots, d_n$ ($0 \le d_i \le 100$)  — the depths of each meter of sea Koa measured.

It is guaranteed that the sum of $n$ over all test cases does not exceed $100$.


-----Output-----

For each test case:

Print Yes if Koa can get from the shore to the island, and No otherwise.

You may print each letter in any case (upper or lower).


-----Example-----
Input
7
2 1 1
1 0
5 2 3
1 2 3 2 2
4 3 4
0 2 4 3
2 3 5
3 0
7 2 3
3 0 2 1 3 0 1
7 1 4
4 4 3 0 2 4 2
5 2 3
1 2 3 2 2

Output
Yes
No
Yes
Yes
Yes
No
No



-----Note-----

In the following $s$ denotes the shore, $i$ denotes the island, $x$ denotes distance from Koa to the shore, the underline denotes the position of Koa, and values in the array below denote current depths, affected by tide, at $1, 2, \dots, n$ meters from the shore.

In test case $1$ we have $n = 2, k = 1, l = 1, p = [ 0, 1 ]$.

Koa wants to go from shore (at $x = 0$) to the island (at $x = 3$). Let's describe a possible solution:

  Initially at $t = 0$ the beach looks like this: $[\underline{s}, 1, 0, i]$.  At $t = 0$ if Koa would decide to swim to $x = 1$, beach would look like: $[s, \underline{2}, 1, i]$ at $t = 1$, since $2 > 1$ she would drown. So Koa waits $1$ second instead and beach looks like $[\underline{s}, 2, 1, i]$ at $t = 1$.  At $t = 1$ Koa swims to $x = 1$, beach looks like $[s, \underline{1}, 0, i]$ at $t = 2$. Koa doesn't drown because $1 \le 1$.  At $t = 2$ Koa swims to $x = 2$, beach looks like $[s, 2, \underline{1}, i]$ at $t = 3$. Koa doesn't drown because $1 \le 1$.  At $t = 3$ Koa swims to $x = 3$, beach looks like $[s, 1, 0, \underline{i}]$ at $t = 4$.  At $t = 4$ Koa is at $x = 3$ and she made it! 

We can show that in test case $2$ Koa can't get to the island.

Difficulty: HARD
Tags: Dynamic programming

Complete search

Greedy algorithms
Skill types: Dynamic programming

Complete search

Greedy algorithms

Starter code:

Solutions:
t = int(input())
for _ in range(t):
	(n, k, l) = [int(x) for x in input().strip().split()]
	d = [int(x) for x in input().strip().split()]
	left = -k
	f = 0
	for i in range(n):
		if d[i] > l:
			print('No')
			f = 1
			break
		d[i] = min(l - d[i], k)
		if d[i] == k:
			left = -k
			continue
		if left >= d[i]:
			print('No')
			f = 1
			break
		left = max(-d[i], left + 1)
	if f == 0:
		print('Yes')


import sys
input = sys.stdin.buffer.readline
T = int(input())
for _ in range(T):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	if max(d) > l:
		print('No')
		continue
	(ls, cur) = ([], [])
	for (i, u) in enumerate(d):
		p = -1 if k <= l - u else l - u
		if p != -1:
			cur.append(p)
		else:
			ls.append(cur)
			cur = []
	ls.append(cur)
	ok = 1
	for cur in ls:
		if len(cur) <= 1:
			continue
		(s, dec) = (n, 1)
		for u in cur:
			if dec:
				s = min(s - 1, u)
				if s == 0:
					dec = 0
			else:
				s += 1
				if u < s:
					ok = 0
	print('Yes' if ok else 'No')


for _ in range(int(input())):
	(n, k, l) = tuple((int(x) for x in input().split()))
	depth = [0] * (n + 1)
	depth[0] = -1000
	cnt = 1
	for x in input().split():
		depth[cnt] = int(x)
		cnt += 1
	dp = [[0 for i in range(k * 2 * n)] for j in range(n + 1)]
	farest = [0] * (k * 2 * n)
	tide = [0] * 2 * k
	for i in range(2 * k):
		if i <= k:
			tide[i] = i
		else:
			tide[i] = k * 2 - i
	for i in range(k * 2 * n):
		dp[0][i] = 1
	able = False
	for i in range(k * 2 * n):
		if i >= 2 * k and farest[i - 2 * k] >= farest[i]:
			able = False
			break
		if farest[i] == n:
			able = True
			break
		if i == 2 * k * n - 1:
			break
		for j in range(farest[i] + 1):
			if dp[j][i] == 1 and depth[j] + tide[(i + 1) % (k * 2)] <= l:
				dp[j][i + 1] = 1
				farest[i + 1] = max(farest[i + 1], j)
			if dp[j][i] == 1 and depth[j + 1] + tide[(i + 1) % (k * 2)] <= l:
				dp[j + 1][i + 1] = 1
				farest[i + 1] = max(farest[i + 1], j + 1)
	print('yes' if able else 'no')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	safe = [0]
	for i in range(n):
		if d[i] + k <= l:
			safe.append(i + 1)
	safe.append(n + 1)
	ok = True
	for i in range(1, len(safe)):
		tide = k
		down = True
		for j in range(safe[i - 1], safe[i] - 1):
			tide += -1 if down else 1
			if down:
				tide -= max(0, d[j] + tide - l)
			if tide < 0 or d[j] + tide > l:
				ok = False
				break
			if tide == 0:
				down = False
	if ok:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(n, k, l) = [int(i) for i in input().split()]
	d = [int(i) for i in input().split()]
	lst = [0] * n
	for i in range(n):
		z = l - d[i]
		if z < 0:
			lst[i] = [0] * (2 * k)
		else:
			lst[i] = [1] * (2 * k) if z > k - 1 else [0] * (k - z) + [1] * (2 * z + 1) + [0] * (k - z - 1)
	for i in range(1, n):
		for j in range(2 * k):
			if lst[i][j] == 1:
				lst[i][j] = max(lst[i][2 * k - 1], lst[i - 1][2 * k - 1]) if j == 0 else max(lst[i][j - 1], lst[i - 1][j - 1])
			if lst[i - 1] == [0] * (2 * k):
				lst[i] = [0] * (2 * k)
	a = max(lst[-1])
	print('No' if a == 0 else 'Yes')


import sys
import os, io
input = sys.stdin.readline

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

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

def print_list(l):
	print(' '.join(map(str, l)))
N = int(input())
for _ in range(N):
	(n, k, l) = read_list()
	d = read_list()
	if max(d) > l:
		print('No')
	else:
		dic = {}
		for i in set(d):
			if i + k <= l:
				dic[i] = (1 << 2 * k + 1) - 1
			else:
				dic[i] = (1 << (l - i) * 2 + 1) - 1 << i + k - l
		flag = True
		now = dic[d[0]]
		tt = (1 << 2 * k + 1) - 1
		for i in range(1, n):
			if now == 0:
				flag = False
				break
			tmp = dic[d[i]]
			if tmp == tt:
				now = tt
			elif now == tt:
				now = tmp
			else:
				now = now >> 1 & tmp
		if flag and now > 0:
			print('Yes')
		else:
			print('No')


for t in range(int(input())):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	a1 = 1 - k
	b1 = k
	for i in range(n):
		if d[i] > l:
			print('No')
			break
		a2 = max(d[i] - l, 1 - k)
		b2 = min(l - d[i], k)
		a = a1 + 1
		if b1 == k:
			a = 1 - k
		a2 = max(a2, a)
		if a2 > b2:
			print('No')
			break
		a1 = a2
		b1 = b2
	else:
		print('Yes')


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

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

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

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

def out(var):
	sys.stdout.write(str(var) + '\n')
from fractions import Fraction
INF = float('inf')
mod = int(1000000000.0) + 7
for t in range(int(data())):
	(n, k, l) = mdata()
	d = mdata()
	flag = True
	m = k
	p = 0
	for j in range(0, n):
		if l - d[j] >= k:
			m = k - 1
			p = 0
		else:
			if d[j] + m > l and p == 1 or d[j] > l:
				flag = False
				break
			if p == 0:
				m = min(m - 1, l - d[j] - 1)
				if m == -1:
					p = 1
					m = 1
			else:
				m += 1
	if flag == True:
		out('Yes')
	else:
		out('No')


for t in range(int(input())):
	(n, k, l) = map(int, input().split())
	d = [False]
	d += list(map(int, input().split()))
	safe = [0]
	for i in range(n):
		if d[i] + k <= l:
			safe.append(i)
	safe.append(n + 1)
	n = len(safe)
	not_drown = True
	i = 1
	while i < n and not_drown:
		tide = k
		down = True
		start = safe[i - 1] + 1
		end = safe[i]
		for j in range(start, end):
			if down:
				tide -= 1
			else:
				tide += 1
			if down:
				tide -= max(0, d[j] + tide - l)
			if tide < 0 or d[j] + tide > l:
				not_drown = False
				break
			if tide == 0:
				down = False
		i += 1
	if not_drown:
		print('Yes')
	else:
		print('No')


t = int(input())
while t:
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	safe = []
	safe.append(-1)
	for i in range(0, n):
		if d[i] + k <= l:
			safe.append(i)
	if safe[-1] == n - 1:
		pass
	else:
		safe.append(n - 1)
	for val in range(1, len(safe)):
		for i in range(0, 2 * k):
			time = i
			for j in range(safe[val - 1], safe[val] + 1):
				time = time + 1
				temp = 0
				if time % (2 * k) <= k:
					if j == -1:
						temp = 0
					else:
						temp = d[j] + time % (2 * k)
				elif j == -1:
					temp = 0
				else:
					temp = d[j] - time % (2 * k) + 2 * k
				if temp > l:
					break
			else:
				break
		else:
			print('No')
			break
	else:
		print('Yes')
	t = t - 1


ans = []
for stp in range(int(input())):
	(n, k, L) = map(int, input().split())
	u = list(map(int, input().split()))
	p = list(range(k)) + list(range(k, 0, -1))
	w = [1] * (2 * k)
	for i in range(n):
		w1 = [0] * (2 * k)
		for j in range(2 * k):
			if w[j] == 0:
				continue
			for j1 in range(2 * k):
				if u[i] + p[(j + j1) % len(p)] > L:
					break
				w1[(j + j1 + 1) % len(p)] = 1
		w = w1[:]
	if 1 in w:
		ans.append('Yes')
	else:
		ans.append('No')
print('\n'.join(ans))


T = int(input())
for _ in range(T):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	ranges = []
	t = -1000000000
	co = 0
	for i in range(n):
		ch = [max(t + 1, -l + d[i]), l - d[i]]
		t = max(-l + d[i], t + 1)
		if k <= l - d[i]:
			ch = [-1000000000, 102]
			t = -1000000000
		ranges.append(ch)
		if ranges[i][0] > ranges[i][1]:
			print('NO')
			co = 1
			break
	if co == 0:
		print('YES')


for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	dd = list(map(int, input().split()))
	(t, curld, di) = (0, 0, False)
	for d in [-2 ** 30, *dd]:
		if d > l:
			break
		ld = l - d
		if d + k <= l:
			(curld, di) = (ld, False)
			continue
		if di:
			if ld >= curld + 1:
				curld += 1
			else:
				break
		else:
			curld = min(curld - 1, ld)
			if curld == 0:
				di = True
	else:
		print('Yes')
		continue
	print('No')


T = int(input())
for _ in range(T):
	(N, K, L) = map(int, input().split())
	D = list(map(int, input().split()))
	P = list(range(K)) + list(range(K, 0, -1))
	dp = [[0] * len(P) for _ in range(N + 1)]
	for i in range(len(P)):
		dp[0][i] = 1
	for i in range(N):
		for _ in range(2):
			for j in range(len(P)):
				if dp[i][j] == 0:
					continue
				if i and dp[i][(j + 1) % len(P)] == 0 and (D[i - 1] + P[(j + 1) % len(P)] <= L):
					dp[i][(j + 1) % len(P)] = 1
				if D[i] + P[(j + 1) % len(P)] <= L:
					dp[i + 1][(j + 1) % len(P)] = 1
	print('No' if all((a == 0 for a in dp[-1])) else 'Yes')


import math

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

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

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

def si():
	return input().split()
t = ii()
for _ in range(t):
	(n, k, l) = mi()
	a = li()
	dp = [0 for i in range(n)]
	ans = True
	rev = False
	if a[0] + k <= l:
		dp[0] = 'F'
	elif a[0] <= l:
		dp[0] = l - a[0]
		if dp[0] > 0:
			rev = True
		else:
			rev = False
	else:
		dp[0] = -1
	for i in range(1, n):
		if dp[i - 1] == -1 or a[i] > l:
			ans = False
			break
		if a[i] + k <= l:
			dp[i] = 'F'
		elif dp[i - 1] == 'F':
			dp[i] = l - a[i]
			if dp[i] > 0:
				rev = True
			else:
				rev = False
		elif rev:
			if l - a[i] <= dp[i - 1] - 1:
				dp[i] = l - a[i]
				if dp[i] > 0:
					rev = True
				else:
					rev = False
			else:
				dp[i] = dp[i - 1] - 1
				if dp[i] > 0:
					rev = True
				else:
					rev = False
		elif dp[i - 1] + 1 + a[i] <= l:
			dp[i] = dp[i - 1] + 1
			if dp[i] == k:
				rev = True
		else:
			ans = False
			break
	if ans:
		print('Yes')
	else:
		print('No')


def main():
	t = int(input())
	for i in range(t):
		(n, k, l) = map(int, input().split())
		d = tuple(map(int, input().split()))
		output = 'Yes' if _can_get_to_finish(d, k, l) else 'No'
		print(output)

def _can_get_to_finish(depths, max_tide_height, max_height_can_swim):
	tide_heights_allowed = [max_height_can_swim - depth for depth in depths]
	get_tide_height = lambda time: _get_tide_height_by_time(time, max_tide_height)
	next_pos = 0
	last_checkpoint = None
	while True:
		prev_checkpoint = last_checkpoint
		next_time = -tide_heights_allowed[next_pos]
		while next_pos < len(tide_heights_allowed):
			allowed_height = tide_heights_allowed[next_pos]
			if allowed_height >= max_tide_height and next_pos != prev_checkpoint:
				last_checkpoint = next_pos
				next_pos += 1
				break
			if get_tide_height(next_time) > allowed_height:
				how_much_must_decrease = get_tide_height(next_time) - allowed_height
				if next_time + how_much_must_decrease > 0:
					return False
				next_time += how_much_must_decrease
			if get_tide_height(next_time) > allowed_height:
				if last_checkpoint is not None:
					next_pos = last_checkpoint
				else:
					next_pos = 0
				break
			next_pos += 1
			next_time += 1
		if next_pos >= len(tide_heights_allowed):
			return True
		if last_checkpoint == prev_checkpoint:
			return False

def _get_tide_height_by_time(time, max_tide_height):
	time %= 2 * max_tide_height
	if time < max_tide_height:
		result = time
	else:
		time_since_max = time - max_tide_height
		result = max_tide_height - time_since_max
	return result
main()


t = int(input())
for _ in range(t):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	if max(d) > l:
		print('No')
	else:
		p = [i for i in range(1, k)] + [k] + [i for i in range(k - 1, 0, -1)]
		groups = []
		limit = l - k
		g = []
		for i in range(n):
			if d[i] <= limit:
				if g:
					groups.append(g)
					g = []
			else:
				g.append(d[i] - limit)
				if i == n - 1:
					groups.append(g)
		ans = True
		for g in groups:
			n_g = len(g)
			if n_g <= len(p):
				if any((all((p[j:n_g + j][i] >= g[i] for i in range(n_g))) for j in range(len(p) - n_g + 1))):
					pass
				else:
					ans = False
			else:
				ans = False
		if ans:
			print('Yes')
		else:
			print('No')


import time, math as mt, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

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

def IO():
	return stdin.readline()

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

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

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

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

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return
mod = 10 ** 9 + 7

def solve():
	(n, k, l) = IP()
	d = L()
	p = [0] * (2 * k)
	for i in range(2 * k):
		if i <= k:
			p[i] = i
		else:
			p[i] = 2 * k - i
	dp = [[False for j in range(2 * k)] for i in range(n + 1)]
	for i in range(2 * k):
		dp[0][i] = True
	for i in range(1, n + 1):
		arrived = False
		for t in range(2 * k):
			if arrived:
				if d[i - 1] + p[t] <= l:
					dp[i][t] = True
				else:
					arrived = False
			elif d[i - 1] + p[t] <= l and dp[i - 1][(t - 1) % (2 * k)] == True:
				arrived = True
				dp[i][t] = True
	for t in range(2 * k):
		if dp[n][t] == True:
			P('YES')
			return
	else:
		P('NO')
		return
t = II()
for i in range(t):
	solve()


t = int(input())
for _ in range(t):
	(n, k, l) = map(int, input().split())
	arr = list(map(int, input().split()))
	maximum = k
	minimum = -k
	flag = True
	for i in range(n):
		if arr[i] > l:
			flag = False
			break
		maximum = min(l - arr[i], k)
		if maximum == k:
			minimum = -k
		else:
			minimum = max(minimum + 1, -maximum)
		if minimum > maximum:
			flag = False
			break
	if flag:
		print('Yes')
	else:
		print('No')


import sys
import collections

def input():
	return sys.stdin.readline().rstrip()

def split_input():
	return [int(i) for i in input().split()]
tests = int(input())
for _ in range(tests):
	(n, k, l) = split_input()
	d = split_input()
	newd = [l - i for i in d]
	if min(newd) < 0:
		print('No')
		continue
	kvalue = newd[0]
	dec = True
	ans = True
	i = 1
	while i < n:
		if newd[i] < 0:
			ans = False
			break
		if newd[i] >= k:
			if i < n - 1:
				kvalue = newd[i + 1]
				dec = True
				i += 2
				continue
		if kvalue == 0:
			dec = False
		if dec:
			if newd[i] < kvalue:
				kvalue = newd[i]
			else:
				kvalue -= 1
		elif newd[i] <= kvalue:
			ans = False
			break
		else:
			kvalue += 1
		i += 1
	if ans:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	depth = list(map(int, input().split()))
	fg = 1
	mn = -k
	mx = k
	for i in depth:
		if i > l:
			fg = 0
			break
		mx = min(l - i, k)
		if mx == k:
			mn = -k
		else:
			mn = max(mn + 1, -mx)
		if mn > mx:
			fg = 0
			break
	if fg:
		print('Yes')
	else:
		print('No')


import sys

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

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	(n, k, l) = mints()
	x = 0
	pz = k
	for d in mints():
		z = l - d
		if z < 0:
			print('No')
			return
		if z >= k:
			x = 0
		elif x < k:
			x = max(x + 1, k - z)
		elif x >= k:
			x = x + 1
			if x - k > z:
				print('No')
				return
		pz = max(z, k)
	print('Yes')
for i in range(mint()):
	solve()


t = int(input())
for test in range(t):
	(n, k, l) = input().split()
	(n, k, l) = (int(n), int(k), int(l))
	arr = list(map(int, input().split()))
	maxi = k
	mini = -k
	flag = True
	for i in range(n):
		if arr[i] > l:
			flag = False
			break
		maxi = min(l - arr[i], k)
		if maxi == k:
			mini = -k
		else:
			mini = max(mini + 1, -maxi)
		if mini > maxi:
			flag = False
			break
	if flag:
		print('Yes')
	else:
		print('No')


for t in range(int(input())):
	(n, k, l) = list(map(int, input().split()))
	d = list(map(int, input().split()))
	dd = [l - i for i in d]
	pos = 0
	if dd[0] >= 0:
		val = dd[0]
		sign = -1
	else:
		print('NO')
		continue
	while pos < n:
		if pos < n - 1 and dd[pos + 1] < 0:
			break
		if val > dd[pos]:
			break
		if dd[pos] >= k:
			if pos != n - 1:
				val = dd[pos + 1]
				sign = -1
				pos += 1
				continue
		elif pos < n - 1 and val + sign > dd[pos + 1] >= 0:
			pos -= 1
		if val == k:
			sign = -sign
		if val == 0:
			sign = -sign
		val += sign
		pos += 1
	print(['NO', 'YES'][pos == n])


import sys
sys.setrecursionlimit(100000)

def f(i, j):
	if j == n + 1:
		return True
	if dp1[i][j] != -1:
		return dp1[i][j]
	else:
		s = set()
		for i1 in range(i, i + 2 * k):
			if dp[i1 % (2 * k)][j] > l:
				break
			if dp[(i1 + 1) % (2 * k)][j + 1] <= l:
				s.add(f((i1 + 1) % (2 * k), j + 1))
		if True in s:
			dp1[i][j] = True
			return True
		dp1[i][j] = False
		return False
for _ in range(int(input())):
	global l, k, n
	(n, k, l) = map(int, input().split())
	a = [int(o) for o in input().split()]
	dp = [[0 for i in range(n + 2)] for j in range(2 * k)]
	dp1 = [[-1 for i in range(n + 2)] for j in range(2 * k)]
	for i in range(n):
		dp[0][i + 1] = a[i]
		for j in range(2 * k):
			if j <= k:
				dp[j][i + 1] = a[i] + j
			else:
				dp[j][i + 1] = a[i] + k - (j - k)
	print('Yes' if f(0, 0) else 'No')


for _ in range(int(input())):
	nkl = list(map(int, input().split()))
	n = nkl[0]
	k = nkl[1]
	l = nkl[2]
	d = list(map(int, input().split()))
	flag = 1
	count = 0
	leez = 0
	for i in range(n):
		if d[i] > l:
			flag = 0
			break
		else:
			if l - d[i] >= k:
				count = 0
				continue
			count += 1
			if count == 1:
				leez = l - d[i]
				continue
			leez = min(leez - 1, l - d[i])
			if leez >= 0:
				continue
			if -leez <= l - d[i]:
				continue
			else:
				flag = 0
				break
	if flag == 1:
		print('Yes')
	else:
		print('No')


import os, sys
from io import BytesIO, IOBase

def check(k, l, d, st, en):
	ad = k - 1
	for i in range(st + 1, en):
		if d[i] + abs(ad) <= l:
			ad -= 1
		else:
			if ad <= 0:
				return 0
			ad = l - d[i] - 1
	return 1

def solve(n, k, l, d):
	stops = [-1]
	for (ind, i) in enumerate(d):
		if i + k <= l:
			stops.append(ind)
		elif i > l:
			return 'NO'
	stops.append(n)
	for i in range(1, len(stops)):
		if not check(k, l, d, stops[i - 1], stops[i]):
			return 'NO'
	return 'YES'

def main():
	for _ in range(int(input())):
		(n, k, l) = map(int, input().split())
		d = list(map(int, input().split()))
		print(solve(n, k, l, d))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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


t = int(input())
while t > 0:
	(n, k, l) = map(int, input().split())
	a = list(map(int, input().split()))
	if max(a) > l:
		print('No')
	else:
		for i in range(n):
			if a[i] + k <= l:
				a[i] = -1
		ghata = -1
		p = 1
		y = 0
		for i in range(n):
			if a[i] == -1:
				ghata = -1
			elif ghata == -1:
				ghata = l - a[i]
				y = 0
				if ghata == 0:
					y = 1
					ghata += 1
				elif i != n - 1 and a[i + 1] != -1:
					ghata = ghata - 1
					if l < ghata + a[i + 1]:
						ghata = l - a[i + 1]
			elif a[i] + ghata > l:
				if y == 0:
					if l < ghata + a[i]:
						ghata = l - a[i]
					if ghata == 0:
						ghata += 1
						y = 1
					else:
						ghata = ghata - 1
				else:
					p = 0
					break
			elif y == 1 or ghata == 0:
				ghata = ghata + 1
				y = 1
			else:
				ghata = ghata - 1
		if p == 0:
			print('No')
		else:
			print('Yes')
	t = t - 1


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, K, L, D):
	MOD = 2 * K
	if False:

		def getDepth(i, t):
			m = t % MOD
			tide = min(m, MOD - m)
			depth = D[i] + tide
			return depth
		for t in range(MOD):
			print(t, [getDepth(i, t) for i in range(N)])
	intervals = [(0, MOD - 1)]
	for (i, d) in enumerate(D):
		if d > L:
			return 'No'
		if d + K <= L:
			intervals = [(0, MOD - 1)]
			continue
		leaveIntervals = []
		for (s, e) in intervals:
			if e + 1 >= MOD:
				leaveIntervals.append((s + 1, MOD - 1))
				leaveIntervals = [(0, 0)] + leaveIntervals
			else:
				leaveIntervals.append((s + 1, e + 1))
		needed = L - d
		arriveIntervals = [(0, needed), (MOD - needed, MOD - 1)]
		newIntervals = []
		for leaveInterval in leaveIntervals:
			for arriveInterval in arriveIntervals:
				if leaveInterval[1] < arriveInterval[0] or arriveInterval[1] < leaveInterval[0]:
					continue
				newInterval = (max(leaveInterval[0], arriveInterval[0]), min(leaveInterval[1], arriveInterval[1]))
				if newIntervals and newIntervals[-1][-1] + 1 == newInterval[0]:
					old = newIntervals.pop()
					newIntervals.append((old[0], newInterval[1]))
				else:
					newIntervals.append(newInterval)
		if not newIntervals:
			return 'No'
		intervals = newIntervals
	return 'Yes'
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(N, K, L) = [int(x) for x in input().split()]
	D = [int(x) for x in input().split()]
	ans = solve(N, K, L, D)
	print(ans)


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

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

def st():
	return input()

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

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

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

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

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

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

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

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

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

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

def iu():
	(n, p, q) = mj()
	L = le()
	(a, b) = (p, -p)
	g = 1
	for i in range(n):
		if q < L[i]:
			g = 0
			break
		a = min(q - L[i], p)
		if a != p:
			b = max(1 + b, -a)
		else:
			b = -q
		if a < b:
			g = 0
			break
	if g == 1:
		print('Yes')
	else:
		print('No')

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

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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


for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(range(k + 1)) + list(range(k - 1, 0, -1))
	gg = []
	for i in range(2 * k):
		if b[i] + a[-1] <= l:
			gg.append(i)
	for i in range(n - 2, -1, -1):
		for j in range(len(gg)):
			gg[j] = (gg[j] - 1) % (2 * k)
		x = []
		for j in gg:
			r = j
			if b[j] + a[i] <= l:
				if j not in x:
					x.append(j)
				r -= 1
				while r != j and b[r % (2 * k)] + a[i] <= l:
					if r not in x:
						x.append(r)
					r -= 1
					r %= 2 * k
		gg = x[:]
	if len(gg) == 0:
		print('No')
	else:
		print('Yes')


t = int(input())
for i in range(t):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	p = [0]
	for j in range(1, k + 1):
		p.append(j)
	for j in range(k - 1, 0, -1):
		p.append(j)
	dp = [[0 for j in range(2 * k + 1)] for z in range(n + 1)]
	ans = False
	for j in range(1, 2 * k + 1):
		if d[0] + p[j % (2 * k)] <= l:
			dp[0][j % (2 * k)] = 1
			ans = True
	if not ans:
		print('No')
	else:
		ans = 'No'
		for j in range(1, n):
			for z in range(2 * k):
				if dp[j - 1][z] == 1:
					for y in range(1, 2 * k + 1):
						if d[j - 1] + p[(z + y - 1 + 2 * k) % (2 * k)] > l:
							break
						if d[j] + p[(z + y) % (2 * k)] <= l:
							dp[j][(z + y) % (2 * k)] = 1
		for j in range(2 * k):
			if dp[n - 1][j]:
				ans = 'Yes'
				break
		print(ans)


def solve():
	(n, k, l) = map(int, input().split())
	dp = [[0, -1] for i in range(n)]
	lst = list(map(int, input().split()))
	dp[0][0] = l - lst[0]
	if dp[0][0] < 0:
		print('NO')
		return 0
	for i in range(1, n):
		if k + lst[i] <= l:
			dp[i] = [k, -1]
			continue
		if dp[i - 1][1] == 1:
			if dp[i - 1][0] == k:
				if k - 1 + lst[i] <= l:
					dp[i] = [k - 1, -1]
					continue
				else:
					print('NO')
					return 0
			if dp[i - 1][0] + 1 + lst[i] <= l:
				dp[i] = [dp[i - 1][0] + 1, 1]
			else:
				print('NO')
				return 0
		else:
			num = l - lst[i]
			if num < 0:
				print('NO')
				return 0
			if num < dp[i - 1][0]:
				dp[i][0] = num
			else:
				dp[i][0] = dp[i - 1][0] - 1
				if dp[i][0] == 0:
					dp[i][1] = 1
				elif dp[i][0] == -1:
					dp[i][0] = 1
					dp[i][1] = 1
				if dp[i][0] + lst[i] > l:
					print('NO')
					return 0
	print('YES')
for i in range(int(input())):
	solve()


def main():
	t = int(input())
	for i in range(t):
		(n, k, l) = map(int, input().split())
		d = tuple(map(int, input().split()))
		output = 'Yes' if _can_get_to_finish(d, k, l) else 'No'
		print(output)

def _can_get_to_finish(depths, max_tide_height, max_height_can_swim):
	tide_heights_allowed = [max_height_can_swim - depth for depth in depths]
	if any((allowed_height < 0 for allowed_height in tide_heights_allowed)):
		return False
	sea_size = len(tide_heights_allowed)

	def is_checkpoint(pos):
		return tide_heights_allowed[pos] >= max_tide_height
	get_tide_height = lambda time: _get_tide_height_by_time(time, max_tide_height)
	next_pos = 0
	curr_checkpoint = -1
	while next_pos < sea_size:
		time_of_next_pos = -tide_heights_allowed[next_pos]
		while next_pos < sea_size and (not is_checkpoint(next_pos)):
			max_allowed_height = tide_heights_allowed[next_pos]
			if get_tide_height(time_of_next_pos) > max_allowed_height:
				how_much_must_wait = get_tide_height(time_of_next_pos) - max_allowed_height
				if time_of_next_pos + how_much_must_wait > 0:
					return False
				time_of_next_pos += how_much_must_wait
			next_pos += 1
			time_of_next_pos += 1
		while next_pos < sea_size and is_checkpoint(next_pos):
			curr_checkpoint = next_pos
			next_pos += 1
	return True

def _get_tide_height_by_time(time, max_tide_height):
	time %= 2 * max_tide_height
	if time < max_tide_height:
		result = time
	else:
		time_since_max = time - max_tide_height
		result = max_tide_height - time_since_max
	return result
main()


t = int(input())
for _ in range(t):
	(n, k, l) = list(map(int, input().split()))
	d = list(map(int, input().split()))
	last = 0
	depths = []
	for i in range(len(d)):
		if d[i] <= l - k:
			if len(d[last:i]) > 0:
				depths.append(d[last:i])
			last = i + 1
	if len(d[last:]) > 0:
		depths.append(d[last:])
	cross = True
	for a in depths:
		ok = True
		tide = k
		down = True
		for i in range(len(a)):
			if a[i] > l:
				ok = False
				break
			elif down:
				if tide > l - a[i]:
					tide = l - a[i]
				else:
					tide -= 1
				if tide == 0:
					down = False
			elif a[i] + tide + 1 > l:
				ok = False
				break
			else:
				tide += 1
		if not ok:
			cross = False
			break
	if cross:
		print('Yes')
	else:
		print('No')


production = True
import sys, math, collections

def input(input_format=0, multi=0):
	if multi > 0:
		return [input(input_format) for i in range(multi)]
	else:
		next_line = sys.stdin.readline()[:-1]
		if input_format >= 10:
			use_list = False
			input_format = int(str(input_format)[-1])
		else:
			use_list = True
		if input_format == 0:
			formatted_input = [next_line]
		elif input_format == 1:
			formatted_input = list(map(int, next_line.split()))
		elif input_format == 2:
			formatted_input = list(map(float, next_line.split()))
		elif input_format == 3:
			formatted_input = list(next_line)
		elif input_format == 4:
			formatted_input = list(map(int, list(next_line)))
		elif input_format == 5:
			formatted_input = next_line.split()
		else:
			formatted_input = [next_line]
		return formatted_input if use_list else formatted_input[0]

def out(output_line, output_format=0, newline=True):
	formatted_output = ''
	if output_format == 0:
		formatted_output = str(output_line)
	elif output_format == 1:
		formatted_output = ' '.join(map(str, output_line))
	elif output_format == 2:
		formatted_output = '\n'.join(map(str, output_line))
	elif output_format == 3:
		formatted_output = ''.join(map(str, output_line))
	print(formatted_output, end='\n' if newline else '')

def log(*args):
	if not production:
		print('$$$', end='')
		print(*args)
enu = enumerate
ter = lambda a, b, c: b if a else c
ceil = lambda a, b: -(-a // b)
flip = lambda a: a + 1 & 1

def mapl(iterable, format=0):
	if format == 0:
		return list(map(int, iterable))
	elif format == 1:
		return list(map(str, iterable))
	elif format == 2:
		return list(map(list, iterable))

def solve():
	(n, k, l) = input(1)
	d = input(1)
	log(k, l)
	log(d)
	f = [l - i for i in d]
	log(f)
	p = [(0, 2 * k - 1)]
	for i in f:
		(a, b) = p[-1]
		if i >= k:
			p.append((0, 2 * k - 1))
		else:
			fb = k + i
			fa = max(a + 1, k - i)
			log(i, fb, fa)
			if fb < fa:
				out('No')
				return
			p.append((fa, fb))
		log(p)
	else:
		out('Yes')
	log('')
	return
for i in range(input(11)):
	solve()


t = int(input())
for _ in range(t):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	p = list(range(k)) + list(range(k, 0, -1))
	pos = list(range(2 * k))
	ans = 'Yes'
	for i in range(n):
		new_pos = []
		for t in pos:
			j = 1
			for j in range(1, 2 * k + 1):
				if d[i] + p[(t + j) % (2 * k)] > l:
					break
				new_pos.append((t + j) % (2 * k))
		pos = list(set(new_pos))
		if len(pos) == 0:
			ans = 'No'
	print(ans)


from sys import stdin
import sys
sys.setrecursionlimit(1500)
input = stdin.readline

def dp(curStage, curK, firstK, n, l, k, results):
	if curStage == n:
		return True
	nextK = (curK + 1) % (2 * k)
	if nextK >= k:
		nextLevelWait = d[curStage] + (2 * k - nextK)
		nextLevelGo = d[curStage + 1] + (2 * k - nextK)
	else:
		nextLevelWait = d[curStage] + nextK
		nextLevelGo = d[curStage + 1] + nextK
	a = False
	b = False
	if nextLevelGo <= l:
		if (curStage + 1, nextK) in results:
			a = False
		else:
			a = dp(curStage + 1, nextK, nextK, n, l, k, results)
			if not a:
				results.add((curStage + 1, nextK))
	if a:
		return a
	if nextLevelWait <= l and nextK != firstK:
		if (curStage, nextK) in results:
			b = False
		else:
			b = dp(curStage, nextK, firstK, n, l, k, results)
			if not b:
				results.add((curStage, nextK))
	if b:
		return b
t = int(input())
for _ in range(t):
	(n, k, l) = list(map(int, input().rstrip().split(' ')))
	d2 = list(map(int, input().rstrip().split(' ')))
	d = [-999]
	d.extend(d2)
	r = set()
	if dp(0, 0, 0, n, l, k, r):
		print('Yes')
	else:
		print('No')


t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	k = int(l[1])
	l = int(l[2])
	lo = input().split()
	li = [int(i) for i in lo]
	arr = []
	poss = 1
	for i in li:
		if i > l:
			poss = 0
			break
		z = min(l - i, k)
		arr.append([-z, z])
	if poss == 0:
		print('no')
		continue
	for i in range(n):
		if i != 0:
			if arr[i][0] < curr and arr[i][0] != -k:
				arr[i][0] = curr
		curr = arr[i][0] + 1
		if arr[i][1] < arr[i][0]:
			poss = 0
			break
	if poss == 0:
		print('no')
	else:
		print('yes')


import sys
input = sys.stdin.readline
T = int(input())
for testcase in range(1, T + 1):
	(n, k, p) = map(int, input().split())
	D = list(map(int, input().split()))
	flag = True
	sta = 0
	end = 2 * k
	for d in D:
		if not flag:
			break
		if d > p:
			flag = False
		else:
			if d + k <= p:
				s = 0
				t = 2 * k
			else:
				s = k - (p - d)
				t = k + (p - d)
			if end + 1 < s or sta + 1 > t:
				flag = False
			else:
				if sta + 1 <= s <= end + 1:
					sta = s
					end = t
				else:
					sta = sta + 1
					end = t
				if end == 2 * k:
					sta = 0
	if flag:
		print('Yes')
	else:
		print('No')


import io
import os
from collections import Counter, defaultdict, deque
from functools import lru_cache

def solve(N, K, L, D):

	def getDepth(i, t):
		m = t % (2 * K)
		tide = min(m, 2 * K - m)
		depth = D[i] + tide
		return depth

	@lru_cache(maxsize=None)
	def isReachable(i, t):
		if i == N:
			return True
		if getDepth(i, t) > L:
			return False
		for wait in range(2 * K):
			if getDepth(i, t + wait) > L:
				break
			if isReachable(i + 1, t + wait + 1):
				return True
		return False
	for t in range(2 * K):
		if isReachable(0, t + 1):
			return 'Yes'
	return 'No'
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(N, K, L) = [int(x) for x in input().split()]
	D = [int(x) for x in input().split()]
	ans = solve(N, K, L, D)
	print(ans)


for _ in range(int(input())):
	(n, k, l) = map(int, input().strip().split(' '))
	arr = list(map(int, input().strip().split(' ')))
	goods = []
	bad = False
	for (i, a) in enumerate(arr):
		if a + k <= l:
			goods.append(i)
		if a > l:
			bad = True
			break
	if bad:
		print('No')
		continue
	goods.append(n)
	prev = -1
	for g in goods:
		st = prev
		en = g
		if st + 1 == en:
			prev = g
			continue
		tk = k
		while st < en - 1 and tk > 0:
			st += 1
			tk -= 1
			plc = arr[st] + tk
			if plc > l:
				tk -= plc - l
			if tk < 0:
				bad = True
		if tk == 0:
			while st < en - 1:
				st += 1
				tk += 1
				plc = arr[st] + tk
				if plc > l:
					bad = True
					break
		if bad:
			break
		prev = g
	if bad:
		print('No')
	else:
		print('Yes')


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

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

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

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]
for _ in range(II()):
	(n, k, l) = MI()
	s = t = -1
	ng = False
	for d in MI():
		if d > l:
			ng = True
			break
		mx = d + k
		if mx <= l:
			s = -1
			continue
		s += 1
		t += 1
		ns = mx - l
		nt = 2 * k - ns
		if s == 0:
			(s, t) = (ns, nt)
			continue
		if t < ns or nt < s:
			ng = True
			break
		s = max(s, ns)
		t = nt
	if ng:
		print('No')
	else:
		print('Yes')


from sys import stdin, stdout, setrecursionlimit
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log, log2
from random import seed, randint
from datetime import datetime
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
from collections import defaultdict as dd
mod = pow(10, 9) + 7
mod2 = 998244353

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

def iinp():
	return int(inp())

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

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

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

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

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

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def def_value():
	return 0

def def_inf():
	return inf

def atoi(s):
	return ord(s) - ord('a')

def inc(s, n=1):
	return chr((ord(s) - ord('a') + n) % 26 + ord('a'))

class XY:

	def __init__(self, x, y):
		self.x = x
		self.y = y

def rotate(a, b, c):
	ang = (b.y - a.y) * (c.x - b.x) - (b.x - a.x) * (c.y - b.y)
	if ang == 0:
		return 0
	else:
		return ang / abs(ang)

def phi(n):
	(res, p) = (n, 2)
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			res -= res // p
		p += 1
	if n > 1:
		res -= res // n
	return res
for i in range(iinp()):
	(n, k, l) = mp()
	d = lmp()
	p = [i for i in range(k)] + [i for i in range(k, 0, -1)]
	dp = l2d(n + 1, 2 * k)
	for i in range(n + 1):
		for j in range(2 * k):
			if i == 0:
				dp[i][j] = [0, True]
			else:
				dp[i][j] = [d[i - 1] + p[j], False]
	for i in range(1, n + 1):
		for j in range(2 * k):
			if dp[i][j][0] <= l:
				if dp[i - 1][j - 1][1]:
					dp[i][j][1] = True
		for j in range(2 * k):
			if dp[i][j][0] <= l:
				if dp[i][j - 1][1]:
					dp[i][j][1] = True
	flg = False
	for i in range(2 * k):
		if dp[n][i][1]:
			flg = True
			break
	if flg:
		print('Yes')
	else:
		print('No')


t = int(input())
for i in range(t):
	(n, k, max_l) = map(int, input().split())
	lissht = list(map(int, input().split()))
	safe = [0]
	for ki in range(n):
		if lissht[ki] + k <= max_l:
			safe.append(ki + 1)
	safe.append(n + 1)
	ans = True
	for j in range(1, len(safe)):
		if ans == False:
			break
		if safe[j] - safe[j - 1] > 1:
			tide = k
			down = True
			for kij in range(safe[j - 1] + 1, safe[j]):
				if down == True:
					tide -= 1
				else:
					tide += 1
				if down == True:
					tide -= max(0, lissht[kij - 1] + tide - max_l)
				if lissht[kij - 1] + tide > max_l or tide < 0:
					ans = False
					break
				if tide == 0:
					down = False
	if ans:
		print('YES')
	else:
		print('NO')


import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def inpt():
	return [int(k) for k in input().split()]

def fun(inc, t, ar, l, x, k, n, dp):
	if x == n:
		return 1
	if ar[x] + inc[t % (2 * k)] > l:
		return 0
	tp = t
	ok = 0
	if (t, x) in dp:
		return dp[t, x]
	temp = 0
	while temp < 2 * k:
		if ar[x] + inc[tp % (2 * k)] > l:
			break
		tp += 1
		val = fun(inc, tp, ar, l, x + 1, k, n, dp)
		ok |= val
		dp[tp, x] = val
		temp += 1
		if ok:
			return ok
	return ok

def main():
	for _ in range(int(input())):
		(n, k, l) = map(int, input().split())
		ar = inpt()
		inc = []
		for i in range(k + 1):
			inc.append(i)
		for i in range(k - 1, 0, -1):
			inc.append(i)
		t = 0
		ans = 0
		x = 0
		dp = {}
		for i in range(2 * k):
			if ar[x] + inc[(t + i) % (2 * k)] > l:
				continue
			ans |= fun(inc, t + i + 1, ar, l, x + 1, k, n, dp)
		if ans:
			print('Yes')
		else:
			print('No')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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


import sys
input = sys.stdin.readline
t = int(input())
for ii in range(t):
	(n, k, l) = map(int, input().split())
	a = [int(i) for i in input().split() if i != '\n']
	safe = []
	for i in range(n):
		if a[i] + k <= l:
			safe.append([[0, 2 * k]])
		elif a[i] <= l:
			(start, end) = (0, l - a[i])
			start2 = k + (k - l + a[i])
			end2 = start2 + l - a[i]
			safe.append([[start, end], [start2, end2]])
		elif a[i] > l:
			safe.append(-1)
	(tin, tout) = (1, 2 * k)
	(store, ok) = (0, False)
	if safe[0] == -1:
		print('No')
		continue
	if len(safe[0]) == 1:
		ok = True
	else:
		tin = safe[0][1][0]
		tout = safe[0][1][1]
		store = 1
	for i in range(len(safe)):
		if safe[i] == -1:
			print('No')
			break
		if len(safe[i]) == 1:
			ok = True
			continue
		if ok:
			tin = (safe[i][1][0] + 1) % (2 * k)
			tout = safe[i][1][1]
			if tin == 1:
				tout = 1
			ok = False
			store = 1
			continue
		for j in range(2):
			if store == 1:
				if safe[i][j][1] >= tin and safe[i][j][0] <= tout:
					tin = (max(tin, safe[i][j][0]) + 1) % (2 * k)
					tout = safe[i][j][1]
					if tin == 1:
						tout = 1
					store = j
					break
			elif safe[i][0][1] >= tin:
				tin = (tin + 1) % (2 * k)
				tout = safe[i][0][1]
				store = 0
				break
		else:
			print('No')
			break
	else:
		print('Yes')


import os
import sys
from io import BytesIO, IOBase

def dfs(G, node, depths, limit, V):
	V.add(node)
	(pos, rise, sign) = (node[0], node[1], node[2])
	if pos == len(depths):
		return True
	ans = False
	if pos != 0 and depths[pos] + rise > limit:
		return ans
	for v in G[node]:
		if v not in V:
			ans = ans or dfs(G, v, depths, limit, V)
	return ans

def main():
	t = int(input())
	for _ in range(t):
		(n, k, l) = map(int, input().split())
		D = [0] + list(map(int, input().split()))
		assert len(D) == n + 1
		graph = dict()
		for pos in range(n + 2):
			for rise in range(k + 1):
				graph[pos, rise, 1] = list()
				graph[pos, rise, -1] = list()
		start = (0, 0, 1)
		for node in graph.keys():
			(pos, rise, sign) = (node[0], node[1], node[2])
			if pos == n + 1:
				continue
			if sign == 1:
				if rise == k:
					newRise = k - 1
					newSign = -1
				else:
					newRise = rise + 1
					newSign = sign
			elif rise == 0:
				newRise = 1
				newSign = 1
			else:
				newRise = rise - 1
				newSign = sign
			graph[node].append((pos, newRise, newSign))
			graph[node].append((pos + 1, newRise, newSign))
		visited = set()
		if dfs(graph, start, D, l, visited):
			print('Yes')
		else:
			print('No')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

	def read(self):
		if self.buffer.tell():
			return self.buffer.read().decode('ascii')
		return os.read(self._fd, os.fstat(self._fd).st_size).decode('ascii')

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

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

def print(*args, sep=' ', end='\n', file=sys.stdout, flush=False):
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(end)
	if flush:
		file.flush()
(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.setrecursionlimit(int(10000000.0))
main()


from sys import stdin, gettrace
if gettrace():
	inputi = input
else:

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

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

def tide(k, t):
	t = t % (2 * k)
	if t <= k:
		return t
	else:
		return 2 * k - t

def solve():
	(n, k, l) = map(int, inputi().split())
	dd = [int(a) for a in inputi().split()]
	if max(dd) > l:
		print('No')
		return
	t = 0
	cache = [[(False, False)] * (2 * k) for _ in range(n)]

	def can_finish(t, i):
		if i == n:
			return True
		if cache[i][t % (2 * k)][0]:
			return cache[i][t % (2 * k)][1]
		cache[i][t % (2 * k)] = (True, False)
		for t1 in range(t + 1, t + 2 * k):
			if dd[i] + tide(k, t1) > l:
				return False
			elif can_finish(t1, i + 1):
				cache[i][t % (2 * k)] = (True, True)
				return True
		return False
	for i in range(2 * k):
		if can_finish(i, 0):
			print('Yes')
			return
	else:
		print('No')

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


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import deque
for ik in range(int(input())):
	(n, k, l1) = map(int, input().split())
	ROW = n
	COL = 2 * k

	class Point:

		def __init__(self, x: int, y: int):
			self.x = x
			self.y = y

	class queueNode:

		def __init__(self, pt: Point, dist: int):
			self.pt = pt
			self.dist = dist

	def isValid(row: int, col: int):
		return row >= 0 and row < ROW and (col >= 0) and (col < COL)
	rowNum = [0, 1, 0, 0]
	colNum = [0, 1, 0, 1]

	def BFS(mat, src: Point, dest: Point):
		if mat[src.x][src.y] != 1 or mat[dest.x][dest.y] != 1:
			return -1
		visited = [[False for i in range(COL)] for j in range(ROW)]
		visited[src.x][src.y] = True
		q = deque()
		s = queueNode(src, 0)
		q.append(s)
		while q:
			curr = q.popleft()
			pt = curr.pt
			if pt.x == dest.x and pt.y == dest.y:
				return curr.dist
			for i in range(4):
				row = pt.x + rowNum[i]
				col = pt.y + colNum[i]
				col %= 2 * k
				if isValid(row, col) and mat[row][col] == 1 and (not visited[row][col]):
					visited[row][col] = True
					Adjcell = queueNode(Point(row, col), curr.dist + 1)
					q.append(Adjcell)
		return -1
	l = list(map(int, input().split()))
	f = 0
	p = [i for i in range(0, k)]
	p1 = [i for i in range(k, 0, -1)]
	p += p1
	dp = [[0 for i in range(2 * k)] for i in range(n)]
	for i in range(0, 2 * k):
		if l[0] + p[i % (2 * k)] <= l1:
			dp[0][i] = 1
	for j in range(1, n):
		for i in range(2 * k):
			if dp[j - 1][i - 1] == 1 or dp[j][(i - 1) % (2 * k)] == 1:
				if l[j] + p[i] <= l1:
					dp[j][i] = 1
	for i in range(2 * k):
		for j in range(2 * k):
			source = Point(0, i)
			dest = Point(n - 1, j)
			dist = BFS(dp, source, dest)
			if dist == -1:
				continue
			else:
				print('Yes')
				f = 1
				break
		if f == 1:
			break
	if f == 0:
		print('No')


for _ in range(int(input())):
	(n, k, l) = list(map(int, input().split()))
	d = list(map(int, input().split()))
	a = [0] * n
	failed = False
	for i in range(n):
		if d[i] + k <= l:
			a[i] = 2 * k
		elif d[i] > l:
			print('No')
			failed = True
			break
		else:
			a[i] = 1 + (l - d[i]) * 2
	if failed:
		continue
	steps = 0
	j = -1
	for i in range(n):
		if a[i] == 2 * k:
			steps = 0
			j = i
		else:
			steps += 1
			if steps >= (2 * k + a[i] + 1) // 2:
				failed = True
				break
			else:
				steps = max(steps, (2 * k - a[i] + 1) // 2)
	print('Yes' if not failed else 'No')


def cut(l, h):
	res = []
	tmp = []
	for i in l:
		if i <= h:
			if len(tmp) > 0:
				res.append(tmp)
			tmp = []
		else:
			tmp.append(i)
	if len(tmp) > 0:
		res.append(tmp)
	return res
for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	x = list(map(int, input().split()))
	x = cut(x, l - k)
	xxx = [[l - i for i in xx] for xx in x]
	kk = [i for i in range(k)] + [i for i in range(k, 0, -1)]
	sol_end = False
	for x in xxx:
		end = False
		for j in range(2 * k):
			case = True
			for i in range(len(x)):
				if x[i] - kk[(i + j) % (2 * k)] < 0:
					case = False
					break
			if case:
				end = True
				break
		if not end:
			sol_end = True
			break
	if sol_end:
		print('NO')
	else:
		print('YES')


import math
import sys

def solve():
	(n, k, l) = map(int, input().split())
	a = list(map(int, input().split()))
	lt = -1
	for i in range(n):
		lt += 1
		if a[i] > l:
			print('No')
			return
		if l - a[i] >= k:
			lt = -1
			continue
		l1 = 2 * k - (l - a[i])
		r1 = 2 * k + (l - a[i])
		if lt == 0:
			lt = l1
			continue
		if lt > r1:
			print('No')
			return
		lt = max(lt, l1)
	print('Yes')
t = int(input())
for tt in range(t):
	solve()


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from operator import add, mul, sub, xor, truediv, floordiv
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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

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

def N():
	return int(input())
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa = ifa[::-1]

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

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

def binfun(x):
	c = 0
	for w in arr:
		c += ceil(w / x)
	return c

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] < self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		for v in graph[u]:
			if v not in d or d[v] > d[u] + graph[u][v]:
				d[v] = d[u] + graph[u][v]
				heappush(heap, (d[v], v))
	return d

def GP(it):
	return [(ch, len(list(g))) for (ch, g) in groupby(it)]

class DLN:

	def __init__(self, val):
		self.val = val
		self.pre = None
		self.next = None
t = N()
for i in range(t):
	(n, k, l) = RLL()
	d = RLL()
	d = [l - x for x in d]
	if any((x < 0 for x in d)):
		ans = False
	else:
		res = []
		cur = []
		for x in d:
			if x >= k:
				if cur:
					res.append(cur)
					cur = []
			else:
				cur.append(x)
		if cur:
			res.append(cur)
		flag = True
		for a in res:
			last = 0
			for x in a:
				low = k - x
				upp = k + x
				cur = max(last + 1, low)
				if cur > upp:
					flag = False
					break
				last = cur
			if not flag:
				break
		ans = flag
	print('YES' if ans else 'NO')


for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	di = list(map(int, input().split()))
	safe = [0 for _ in range(n)]
	p = [_ for _ in range(k + 1)]
	for _ in range(k - 1, 0, -1):
		p.append(_)
	for i in range(n):
		if di[i] > l:
			print('NO')
			break
		if di[i] + k <= l:
			safe[i] = 1
	else:
		i = 0
		safety = safe[0]
		time = len(p) - (l - di[0])
		while i < n - 1:
			height = di[i] + p[time % (2 * k)]
			if height > l:
				print('NO')
				break
			if not safe[i]:
				if di[i + 1] + p[(time + 1) % (2 * k)] <= l:
					i += 1
					time += 1
				else:
					time += 1
			else:
				if safe[i] == 1:
					time = k
					safe[i] = 2
				if di[i + 1] + p[(time + 1) % (2 * k)] <= l:
					i += 1
					time += 1
				else:
					time += 1
		else:
			print('YES')


for _ in range(int(input())):
	(n, k, l) = [int(x) for x in input().split()]
	d = [l - int(x) for x in input().split()]
	p = [t if t <= k else 2 * k - t for t in range(2 * k)]
	dp = [True if p[t] <= d[0] else False for t in range(2 * k)]
	for x in range(1, n):
		rp = [dp[t - 1] if p[t] <= d[x] else False for t in range(2 * k)]
		for t in range(2 * k):
			if p[t] <= d[x]:
				rp[t] = rp[t] or rp[t - 1]
		for t in range(2 * k):
			if p[t] <= d[x]:
				rp[t] = rp[t] or rp[t - 1]
		dp = rp
	if True in dp:
		print('Yes')
	else:
		print('No')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

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

def out(var):
	sys.stdout.write(str(var) + '\n')

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

def l():
	return list(sp())

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

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

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

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

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	(n, k, L) = sp()
	d = l()
	(low, high) = (-k, k)
	result = True
	for i in range(n):
		if d[i] > L:
			result = False
			break
		high = min(L - d[i], k)
		if high == k:
			low = -k
		else:
			low = max(low + 1, -high)
		if low > high:
			result = False
			break
	out(('NO', 'YES')[result])


import os
import sys
from io import BytesIO, IOBase
import threading
from bisect import bisect_right
from math import gcd, log
from collections import Counter

def main():
	(n, k, l) = map(int, input().split())
	arr = list(map(int, input().split()))
	brr = list(range(0, k + 1)) + list(range(k - 1, 0, -1))
	arr.insert(0, -1)
	dp = [[0] * (2 * k) for i in range(n + 2)]
	dp[0] = [1] * (2 * k)
	for i in range(1, n + 1):
		for j in range(2 * k):
			if arr[i] + brr[j] <= l:
				dp[i][j] |= dp[i - 1][(j - 1) % (2 * k)]
		for j in range(4 * k):
			if arr[i] + brr[j % (2 * k)] <= l:
				dp[i][j % (2 * k)] |= dp[i][(j - 1) % (2 * k)]
	if any(dp[n]):
		print('Yes')
	else:
		print('No')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	main()


import sys
input = sys.stdin.buffer.readline

def print(val):
	sys.stdout.write(val + '\n')

def prog():
	for _ in range(int(input())):
		(n, k, l) = map(int, input().split())
		d = [0] + list(map(int, input().split()))
		worked = True
		for i in d:
			if i > l:
				worked = False
		if not worked:
			print('No')
			continue
		free = [0] * (n + 2)
		for i in range(n + 1):
			depth = d[i]
			if depth + k <= l:
				free[i] = 1
		free[0] = 1
		free[n + 1] = 1
		t = 0
		for i in range(n + 2):
			if free[i]:
				t = 0
			else:
				t += 1
				if t > k:
					if t - k + d[i] > l:
						worked = False
						break
				elif k - t + d[i] > l:
					t += k - t + d[i] - l
		if worked:
			print('Yes')
		else:
			print('No')
prog()


for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	d = [int(i) for i in input().split()]
	p = [i for i in range(k)]
	p.extend([i for i in range(k, 0, -1)])
	safe_areas = []
	for (ind, depth) in enumerate(d):
		if depth + k <= l:
			safe_areas.append(ind)
	areas = []
	area = 0
	nexus = []
	for (ind, depth) in enumerate(d):
		if len(safe_areas) != 0 and ind != safe_areas[area]:
			nexus.append(d[ind])
		else:
			if len(nexus) != 0:
				areas.append(nexus)
			nexus = []
			area += 1
			if len(safe_areas) == 0:
				areas.append(d)
				break
			elif area == len(safe_areas):
				areas.append(d[safe_areas[area - 1] + 1:])
				break
	ind = 0
	flag = 0
	while ind < len(areas):
		if len(areas[ind]) == 0:
			ind += 1
		else:
			if areas[ind][0] > l:
				flag = 1
				break
			else:
				difference = l - areas[ind][0]
				areas_copy = list(areas[ind])
				t = difference + 1
				if k >= difference:
					areas[ind] = [el + difference for el in areas[ind]]
				else:
					areas[ind] = [el + k for el in areas[ind]]
				if difference != 0:
					sub_ind = 1
					while difference != 0 and sub_ind < len(areas[ind]):
						areas[ind] = [el - 1 for el in areas[ind]]
						if areas[ind][sub_ind] <= l:
							sub_ind += 1
						difference -= 1
						t -= 1
				else:
					sub_ind = 0
					t = 0
				if sub_ind == len(areas[ind]):
					ind += 1
					continue
				elif areas[ind][sub_ind] + p[t % (2 * k)] > l:
					flag = 1
					break
				else:
					t += 1
					sub_ind += 1
					while sub_ind < len(areas_copy):
						if areas_copy[sub_ind] + p[t % (2 * k)] > l:
							flag = 1
							break
						else:
							sub_ind += 1
							t += 1
			ind += 1
	print('Yes' if flag == 0 else 'No')


from sys import stdin
t = int(stdin.readline())
for case in range(t):
	(n, k, l) = [int(x) for x in stdin.readline().split()]
	d = [l - int(x) for x in stdin.readline().split()]
	good = True
	if min(d) < 0:
		good = False
	cur = -k - 1
	for l in d:
		if l >= k:
			cur = -k - 1
		elif cur + 1 <= -l:
			cur = -l
		elif cur + 1 <= l:
			cur += 1
		else:
			good = False
			break
	if good:
		print('Yes')
	else:
		print('No')


for q in range(int(input())):
	(n, k, l) = map(int, input().split())
	line = list(map(int, input().split()))
	line.append(-1000)
	dp = [[False] * (2 * k) for i in range(n + 2)]
	for i in range(2 * k):
		dp[0][i] = True
	for i in range(1, n + 2):
		for j in range(2 * k):
			if j < k and line[i - 1] + j <= l:
				if dp[i - 1][(j - 1) % (2 * k)]:
					dp[i][j] = True
				elif dp[i][(j - 1) % (2 * k)]:
					dp[i][j] = True
			if j >= k and line[i - 1] + 2 * k - j <= l:
				if dp[i - 1][j - 1]:
					dp[i][j] = True
				elif dp[i][j - 1]:
					dp[i][j] = True
	if max(dp[n + 1]) == True:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline

def riverCross(arr, n, k, l):
	to = None
	jump = 0
	reverse = -1
	ans = None
	if n == 1:
		if arr[0] > l:
			ans = 'No'
			return 'Yes'
		else:
			ans = 'Yes'
			return 'Yes'
	else:
		for i in range(len(arr) - 1):
			minimum = arr[i]
			maximum = arr[i] + k
			if maximum <= l:
				nextMax = arr[i + 1] + k
				if arr[i + 1] > l:
					ans = 'No'
					return 'No'
				elif nextMax <= l:
					jump += 1
					to = arr[i + 1] + k
				else:
					to = nextMax
					while to > l:
						to = to + reverse
						if to == arr[i + 1]:
							reverse = 1
						elif to == arr[i + 1] + k:
							reverse = -1
					jump += 1
			elif minimum > l:
				ans = 'No'
				return 'No'
			else:
				nextMax = arr[i + 1] + k
				if arr[i + 1] > l:
					ans = 'No'
					return 'No'
				elif nextMax <= l:
					to = arr[i + 1] + k
					if to == arr[i + 1]:
						reverse = 1
					elif to == arr[i + 1] + k:
						reverse = -1
					jump += 1
				else:
					if to == None:
						to = arr[i] + k - 1
						while to > l:
							to -= 1
					if reverse == -1:
						gapTime = (to - arr[i]) * 2 + 1
					else:
						gapTime = arr[i] + k - to
					to = arr[i + 1] + k - maximum + to
					if to == arr[i + 1]:
						reverse = 1
					elif to == arr[i + 1] + k:
						reverse = -1
					if reverse == -1:
						to -= 1
					else:
						to += 1
					while to > l:
						gapTime -= 1
						if gapTime == 0 and to > l:
							ans = 'No'
							return 'No'
						to = to + reverse
						if to == arr[i + 1]:
							reverse = 1
					jump += 1
			if to == arr[i + 1]:
				reverse = 1
			elif to == arr[i + 1] + k:
				reverse = -1
			if jump == n - 1:
				if ans == None:
					return 'Yes'

def solution():
	values = list(map(lambda x: int(x), input().split()))
	n = values[0]
	k = values[1]
	l = values[2]
	arr = list(map(lambda x: int(x), input().split()))
	print(riverCross(arr, n, k, l))
t = int(input())
for i in range(0, t):
	solution()


def printMatrix(matrix):
	s = [[str(e) for e in row] for row in matrix]
	lens = [max(map(len, col)) for col in zip(*s)]
	fmt = '\t'.join(('{{:{}}}'.format(x) for x in lens))
	table = [fmt.format(*row) for row in s]
	print('_________________')
	print('\n'.join(table))
	print('`````````````````')
for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	List = [int(x) for x in input().split()]
	Ranges = []
	for i in range(n):
		x = l - List[i]
		if x > k:
			x = k
		Ranges.append([-x, x])
	start = Ranges[0][0]
	flag = 0
	for i in range(1, n):
		if start + 1 > Ranges[i][1]:
			flag = 1
			break
		else:
			if Ranges[i][1] != k:
				Ranges[i][0] = max(start + 1, Ranges[i][0])
			start = Ranges[i][0]
	if flag:
		print('No')
	else:
		print('Yes')


from collections import deque
from collections import OrderedDict
import math
import sys
import os
import threading
import bisect
import operator
import heapq
from atexit import register
from io import BytesIO
import io
input = lambda : sys.stdin.readline().rstrip('\r\n')

def fun1(i, k):
	if i <= k:
		return i
	else:
		return k - (i - k)
for t in range(int(input())):
	(n, k, l) = map(int, input().split())
	ar = [0] + list(map(int, input().split()))
	k2 = 2 * k + 1
	dp = [[0] * (n + 1) for i in range(k2 + 1)]
	for i in range(k2):
		dp[i][0] = 1
	for j in range(1, n + 1):
		for i in range(1, k2):
			if dp[i - 1][j - 1] == 1 and ar[j] + fun1(i, k) <= l:
				dp[i][j] = 1
		dp[0][j] = dp[k2 - 1][j]
		for i in range(1, k2):
			if dp[i - 1][j] == 1 and ar[j] + fun1(i, k) <= l:
				dp[i][j] = 1
	for i in range(k2):
		if dp[i][n] == 1:
			print('Yes')
			break
	else:
		print('No')


from sys import stdin, stdout
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))
for _ in range(nmbr()):
	(n, k, l) = lst()
	a = lst()
	col = 10 ** 4
	dp = [[0 for _ in range(col)] for _ in range(1 + n)]
	chng = [i for i in range(0, k + 1)] + [i for i in range(k - 1, 0, -1)]
	for cc in range(col):
		dp[0][cc] = 1
	for i in range(1, n + 1):
		for j in range(i, col):
			if a[i - 1] + chng[j % (2 * k)] <= l:
				dp[i][j] = dp[i - 1][j - 1] | dp[i][j - 1]
	f = 0
	for i in range(col):
		if dp[n][i]:
			f = 1
			break
	print('Yes' if f else 'No')


inp = lambda : map(int, input().split())
t = int(input())
for _ in range(t):
	(n, k, l) = inp()
	d = list(inp())
	remain = [i for i in range(-1 * (k - 1), 0)] + [i for i in range(k + 1)]
	f = True
	for i in range(n):
		f = False
		new_remain = []
		for j in range(len(remain)):
			temp = remain[j] + 1
			if temp > k:
				temp = -k + 1
			if abs(temp) + d[i] <= l:
				f = True
				new_remain.append(temp)
		if not f:
			print('No')
			break
		remain = []
		flag = False if k + d[i] > l else True
		for j in range(1 - k, k + 1):
			if j in new_remain:
				flag = True
			if abs(j) + d[i] <= l and flag:
				remain.append(j)
			if abs(j) + d[i] > l:
				flag = False
	if f:
		print('Yes')


import sys, os.path
from collections import deque
from fractions import Fraction as f

def IO():
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
		print = sys.stdout.write

def nextInt():
	return int(input())

def nextTuple():
	return [int(a) for a in input().split()]

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

def nextLine():
	return input()

def nextStringArray():
	return list(input().split())
IO()
t = int(input())
for _ in range(t):
	(n, k, l) = [int(x) for x in input().split()]
	a = list(map(int, input().split()))
	flag = 0
	count = -1
	for i in range(n):
		if a[i] > l:
			flag = 1
			break
	for i in range(n):
		if a[i] + k > l:
			if count == -1:
				count = k + (a[i] + k) - l
				continue
			count += 1
			count = count % (2 * k)
			if count <= k:
				if a[i] + count > l:
					flag = 1
					break
			else:
				now = k + (a[i] + k) - l
				count = max(count, now)
		else:
			count = -1
	if flag == 1:
		print('No')
	else:
		print('Yes')


T = int(input())
while T:
	T -= 1
	(N, K, L) = [int(x) for x in input().split()]
	depth = [int(_) for _ in input().split()]
	reach = [[False for j in range(2 * K)] for i in range(N)]
	poss = [[False for j in range(2 * K)] for i in range(N)]
	for i in range(N):
		for j in range(2 * K):
			reach[i][j] = depth[i] + K - abs(K - j) <= L
			poss[i][j] = reach[i][j] and (i == 0 or poss[i - 1][(j - 1 + 2 * K) % (2 * K)])
		for j in range(4 * K):
			if poss[i][(j - 1 + 2 * K) % (2 * K)] and reach[i][j % (2 * K)]:
				poss[i][j % (2 * K)] = True
	print('Yes' if any(poss[N - 1]) else 'No')


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *
k = 0

def p(t):
	global k
	Z = t % (2 * k)
	if Z <= k:
		return Z
	else:
		return k - Z % k

def main():
	global k
	ntest = int(stdin.readline())
	for testcase in range(ntest):
		(n, k, l) = [int(x) for x in stdin.readline().strip().split()]
		d = [int(x) for x in stdin.readline().strip().split()]
		if max(d) > l:
			stdout.write('No\n')
			continue
		avail = set([t for t in range(2 * k)])
		for x in d:
			navail = set()
			for t in avail:
				for z in range(1, 2 * k):
					q = (t + z) % (2 * k)
					if x + p(t + z) <= l and q not in navail:
						navail.add(q)
					else:
						break
			avail = navail
			if len(navail) == 0:
				break
		if len(avail) == 0:
			stdout.write('No\n')
			continue
		stdout.write('Yes\n')
	return 0
main()


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for _ in range(t):
	(n, k, l) = I()
	d = I()
	x = l - k
	d = [0] + d + [0]
	pos = 1
	st = l - d[1]
	if st not in [k, 0]:
		st = 2 * k - st
	ct = st if st <= k else 2 * k - st
	i = 1
	while i < n + 1:
		cd = st if st <= k else 2 * k - st
		if d[i] + k <= l:
			st = k
		else:
			nt = l - d[i]
			if d[i] + cd > l:
				if st <= k:
					pos = 0
					break
				if ct > cd:
					st = 2 * k - nt
				else:
					st = 2 * k
		ct = st if st <= k else 2 * k - st
		st = (st + 1) % (2 * k)
		i += 1
	if max(d) > l:
		pos = 0
	if pos:
		print('Yes')
	else:
		print('No')


for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	inp = list(map(int, input().split()))
	inp = [l - x for x in inp]
	a = []
	cur = []
	ans = 'Yes' if min(inp) >= 0 else 'No'
	for x in inp:
		if x >= k:
			if len(cur) > 1:
				a.append(cur)
			cur = []
		else:
			cur.append(x)
	a.append(cur)
	for ls in a:
		td = k
		dsc = True
		for x in ls:
			if dsc:
				td = min(td - 1, x)
				if td == 0:
					dsc = False
			else:
				td += 1
				if td > x:
					ans = 'No'
	print(ans)


import sys

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7

def bfs(grid, src):
	from collections import deque
	(H, W) = (len(grid), len(grid[0]))
	visited = list3d(2, H, W, 0)
	que = deque()
	for (h, w) in src:
		que.append((0, h, w))
		que.append((1, h, w))
		visited[0][h][w] = 1
		visited[1][h][w] = 1
	while que:
		(up, h, w) = que.popleft()
		if w == N - 1:
			return True
		if h == 0:
			up = 1
		if h == K:
			up = 0
		if up:
			if not visited[up][h + 1][w] and grid[h + 1][w] <= L:
				visited[up][h + 1][w] = 1
				que.append((up, h + 1, w))
			if not visited[up][h + 1][w + 1] and grid[h + 1][w + 1] <= L:
				visited[up][h + 1][w + 1] = 1
				que.append((up, h + 1, w + 1))
		else:
			if not visited[up][h - 1][w]:
				visited[up][h - 1][w] = 1
				que.append((up, h - 1, w))
			if not visited[up][h - 1][w + 1] and grid[h - 1][w + 1] <= L:
				visited[up][h - 1][w + 1] = 1
				que.append((up, h - 1, w + 1))
	return False
for _ in range(INT()):
	(N, K, L) = MAP()
	A = LIST()
	grid = list2d(K + 1, N, 0)
	for i in range(K + 1):
		for j in range(N):
			grid[i][j] = A[j] + i
	src = []
	for i in range(K + 1):
		if grid[i][0] <= L:
			src.append((i, 0))
	ok = False
	for x in range(K + 1):
		if bfs(grid, src):
			Yes()
			break
	else:
		No()


from sys import stdin, stdout

def koa_and_beach(n, k, l, d_a):
	sp_a = []
	for i in range(len(d_a)):
		if d_a[i] + k <= l:
			sp_a.append(i)
		if d_a[i] > l:
			return 'No'
	sp_a.append(n)
	pre = -1
	for i in sp_a:
		down = True
		ct = k
		for j in range(pre + 1, i):
			if down:
				ct -= 1
			else:
				ct += 1
			if d_a[j] + ct > l:
				if down:
					ct = l - d_a[j]
				else:
					return 'No'
			if ct == k:
				down = True
			elif ct == 0:
				down = False
		pre = i
	return 'Yes'
t = int(stdin.readline())
for _ in range(t):
	(n, k, l) = map(int, stdin.readline().split())
	d_a = list(map(int, stdin.readline().split()))
	res = koa_and_beach(n, k, l, d_a)
	stdout.write(str(res) + '\n')


import os, io
from sys import stdout
import collections
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys
sys.setrecursionlimit(10 ** 6)

def primes(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]

def binomial_coefficient(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
		return ntok // ktok
	else:
		return 0

def powerOfK(k, max):
	if k == 1:
		return [1]
	if k == -1:
		return [-1, 1]
	result = []
	n = 1
	while n <= max:
		result.append(n)
		n *= k
	return result

def divisors(n):
	i = 1
	result = []
	while i * i <= n:
		if n % i == 0:
			if n / i == i:
				result.append(i)
			else:
				result.append(i)
				result.append(n / i)
		i += 1
	return result

def distance(xa, ya, xb, yb):
	return ((ya - yb) ** 2 + (xa - xb) ** 2) ** 0.5

def digitsSum(n):
	if n == 0:
		return 0
	r = 0
	while n > 0:
		r += n % 10
		n //= 10
	return r

def isValid(i, j, n, m):
	return i >= 0 and i < n and (j >= 0) and (j < m)

def print_grid(grid):
	for line in grid:
		print(' '.join(map(str, line)))

def kadane(a, size):
	max_so_far = 0
	max_ending_here = 0
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < max_ending_here:
			max_so_far = max_ending_here
		if max_ending_here < 0:
			max_ending_here = 0
	return max_so_far

def prefixSum(arr):
	for i in range(1, len(arr)):
		arr[i] = arr[i] + arr[i - 1]
	return arr

def ceil(n, d):
	if n % d == 0:
		return n // d
	else:
		return n // d + 1

def _abs(a, b):
	return int(abs(a - b))

def evenodd(l):
	even = [e for e in l if e & 1 == 0]
	odd = [e for e in l if e & 1]
	return (even, odd)

def solve(m, i, j, mod, memo):
	if memo[i][j] == -2:
		return 0
	if memo[i][j] != -1:
		return memo[i][j]
	if j == 0:
		memo[i][j] = m[i][j]
		return m[i][j]
	if m[i][j] == 0:
		memo[i][j] = 0
		return 0
	memo[i][j] = -2
	r = solve(m, (i - 1) % mod, j - 1, mod, memo) or solve(m, (i - 1) % mod, j, mod, memo)
	memo[i][j] = r
	return r
for _ in range(int(input())):
	(n, k, l) = list(map(int, input().split()))
	d = list(map(int, input().split()))
	p = []
	for i in range(k + 1):
		p.append(i)
	for i in range(k - 1, 0, -1):
		p.append(i)
	m = [[-1] * len(d) for _ in range(2 * k)]
	for i in range(len(d)):
		for j in range(len(p)):
			if d[i] + p[j] > l:
				m[j][i] = 0
			else:
				m[j][i] = 1
	j = len(d) - 1
	result = False
	memo = [[-1] * len(d) for _ in range(2 * k)]
	for i in range(2 * k - 1, -1, -1):
		if m[i][j] == 1:
			result = result or solve(m, i, j, 2 * k, memo)
	if result:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline
t = int(input())
letters = 'abcdefghijklmnopqrst'
for _ in range(t):
	(n, k, l) = list(map(int, input().split()))
	d = list(map(int, input().split()))
	ll = []
	tot = len(d)
	while len(d) > 0:
		ddd = []
		c = 0
		for el in d:
			ddd.append(el)
			c += 1
			if el + k <= l:
				d = d[c:]
				break
		for j in range(2 * k):
			ok = 1
			for s in range(len(ddd)):
				modif = (j + s + 1) % (2 * k)
				modif = min(modif, 2 * k - modif)
				depth = ddd[s] + modif
				if depth > l:
					ok = 0
			if ok == 1:
				break
		ll.append(ok)
		if len(d) == tot:
			break
		tot = len(d)
	if min(ll) == 1:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(n, k, l) = [int(x) for x in input().split()]
	d = [int(x) for x in input().split()]
	for i in range(n):
		d[i] -= l
	safeSpots = set()
	ok = True
	for i in range(n):
		if d[i] + k <= 0:
			safeSpots.add(i)
		if d[i] > 0:
			print('No')
			ok = False
			break
	if ok == False:
		continue

	def getAdditionalDepth(t):
		t2 = t % (2 * k)
		if t2 > k:
			t2 = 2 * k - t2
		return t2
	ok = True
	t = k
	if d[0] + getAdditionalDepth(t) > 0:
		t += d[0] + getAdditionalDepth(t)
	d.append(-float('inf'))
	for i in range(n):
		if t >= 2 * k:
			t -= 2 * k
		if i + 1 in safeSpots:
			t = k
			continue
		nextDepth = d[i + 1] + getAdditionalDepth(t + 1)
		if nextDepth <= 0:
			t += 1
			continue
		else:
			if t + 1 <= k:
				ok = False
				break
			earliestTime = t + nextDepth
			t = earliestTime + 1
	if ok:
		print('Yes')
	else:
		print('No')


import sys
inpy = [int(x) for x in sys.stdin.read().split()]
t = inpy[0]
index = 1
for _ in range(t):
	(n, k, l) = (inpy[index], inpy[index + 1], inpy[index + 2])
	index += 3
	d = inpy[index:index + n]
	index += n
	(x, m) = (k, True)
	flag = True
	for i in range(n):
		diff = l - d[i]
		if diff < 0:
			flag = False
			break
		if diff >= k:
			x = k
			m = True
		elif m:
			x = min(x - 1, diff)
			if x == 0:
				m = False
		else:
			x = x + 1
			if x > diff:
				flag = False
				break
	if flag:
		print('Yes')
	else:
		print('No')


import sys
import math
from decimal import *

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

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

def ILS():
	return list(map(str, sys.stdin.readline().strip().split()))

def solve():
	tt = I()
	for ii in range(tt):
		(n, k, l) = IL()
		d = IL()
		tmp = []
		kl = []
		for i in range(k + 1):
			tmp.append(0)
		for i in range(k - 1, 0, -1):
			tmp.append(0)
		dp = [tmp.copy() for dd in d]
		for i in range(k + 1):
			kl.append(i)
		for i in range(k - 1, 0, -1):
			kl.append(i)
		for i in range(len(tmp)):
			if d[0] + kl[i] <= l:
				dp[0][i] = 1
			else:
				dp[0][i] = 0
		for i in range(1, len(d)):
			for j in range(len(dp[i])):
				k = j - 1
				if k < 0:
					k = len(dp[i]) - 1
				if d[i] + kl[j] <= l:
					dp[i][j] = 1 if dp[i - 1][k] + dp[i][k] > 0 else 0
				else:
					dp[i][j] = 0
		flag = 0
		for i in range(len(dp[-1])):
			if dp[-1][i] == 1:
				flag = 1
				break
		if flag == 1:
			print('Yes')
		else:
			print('No')
		pass
solve()


def main():
	t = int(input())
	for i in range(t):
		(n, k, l) = map(int, input().split())
		d = tuple(map(int, input().split()))
		output = 'Yes' if _can_get_to_finish(d, k, l) else 'No'
		print(output)

def _can_get_to_finish(depths, max_tide_height, max_height_can_swim):
	tide_heights_allowed = [max_height_can_swim - depth for depth in depths]
	if any((allowed_height < 0 for allowed_height in tide_heights_allowed)):
		return False
	get_tide_height = lambda time: _get_tide_height_by_time(time, max_tide_height)
	next_pos = 0
	curr_checkpoint = None
	while True:
		next_time = -tide_heights_allowed[next_pos]
		while True:
			max_allowed_height = tide_heights_allowed[next_pos]
			if max_allowed_height >= max_tide_height:
				curr_checkpoint = next_pos
				next_pos += 1
				if next_pos >= len(tide_heights_allowed):
					return True
				break
			if get_tide_height(next_time) > max_allowed_height:
				how_much_must_wait = get_tide_height(next_time) - max_allowed_height
				if next_time + how_much_must_wait > 0:
					return False
				next_time += how_much_must_wait
			next_pos += 1
			next_time += 1
			if next_pos >= len(tide_heights_allowed):
				return True

def _get_tide_height_by_time(time, max_tide_height):
	time %= 2 * max_tide_height
	if time < max_tide_height:
		result = time
	else:
		time_since_max = time - max_tide_height
		result = max_tide_height - time_since_max
	return result
main()


import sys
import math
from collections import defaultdict
import heapq
t = int(sys.stdin.readline())
for _ in range(t):
	(n, k, l) = map(int, sys.stdin.readline().split())
	d = list(map(int, sys.stdin.readline().split()))
	p = []
	z = True
	dic = defaultdict(list)
	arr = []
	safe = [False for x in range(n)]
	for i in range(n):
		arr.append(l - d[i])
		if l - d[i] >= k:
			safe[i] = True
		if arr[i] < 0:
			z = False
	if z == False:
		print('No')
		continue
	m = False
	t = k
	z = True
	for i in range(n):
		if safe[i]:
			t = k
			m = False
			continue
		if arr[i] >= t:
			if not m:
				t -= 1
				if t == 0:
					m = True
			else:
				t += 1
				if t == k + 1:
					m = False
					t = k
		elif not m:
			t = arr[i] - 1
			if t == 0:
				m = True
			if t < 0:
				t = 1
				m = True
		else:
			z = False
			break
	if not z:
		print('No')
		continue
	print('Yes')


from collections import *
import sys
from functools import lru_cache

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	(n, k, l) = rl()
	dd = rl()
	p = list(range(k + 1)) + list(range(k))[::-1]

	def get_depth(t, i):
		return dd[i] + p[t % (2 * k)]

	@lru_cache(maxsize=None)
	def canWinFromThere(t, i):
		if i == n:
			return True
		if get_depth(t, i) > l:
			return False
		for wait in range(2 * k):
			if get_depth(t + wait, i) > l:
				break
			if canWinFromThere(t + wait + 1, i + 1):
				return True
		return False
	for u in range(2 * k):
		if canWinFromThere(u, 0):
			print('Yes')
			break
	else:
		print('No')


def go(n, k, l, d):
	p = [0] * (2 * k)
	for t in range(0, 2 * k):
		if t <= k:
			p[t] = t
		else:
			p[t] = 2 * k - t
	h = []
	for x in range(n):
		h_x = [0] * (2 * k)
		for t in range(0, 2 * k):
			h_x[t] = d[x] + p[t]
		h.append(h_x)
	dp = []
	for x in range(n):
		dp.append([False] * (2 * k))
	for t in range(0, 2 * k):
		if h[0][t] <= l:
			dp[0][t] = True
		else:
			dp[0][t] = False
	for x in range(1, n):
		for t in range(0, 2 * k):
			if dp[x - 1][(t - 1) % (2 * k)] and h[x - 1][(t - 1) % (2 * k)] <= l and (h[x][t] <= l):
				dp[x][t] = True
		for t in range(0, 2 * k):
			if dp[x][(t - 1) % (2 * k)] and h[x][(t - 1) % (2 * k)] <= l and (h[x][t] <= l):
				dp[x][t] = True
	for t in range(0, 2 * k):
		if dp[n - 1][t]:
			return True
	return False
t = int(input())
for _ in range(t):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	if go(n, k, l, d):
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(n, k, l) = list(map(int, input().split()))
	N = list(map(int, input().split()))
	K = [i for i in range(k + 1)]
	for i in range(k - 1, -1, -1):
		K.append(i)
	A = [1] * 2 * k
	for i in range(0, n):
		temp = [0] * 2 * k
		for j in range(2 * k):
			if N[i] + K[j] <= l:
				if A[j - 1] == 1:
					temp[j] = 1
		for j in range(2 * k):
			if N[i] + K[j] <= l:
				if temp[j - 1] == 1:
					temp[j] = 1
		A = temp
	if sum(A) > 0:
		print('YES')
	else:
		print('NO')


def solve(arr, n, k, l):
	min_t = 0
	for v in arr:
		if v > l:
			return False
		if k + v <= l:
			min_t = 0
		else:
			new_min_t = k - l + v
			min_t = max(min_t + 1, new_min_t)
		if min_t > k + l - v:
			return False
	return True
for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	(*arr,) = map(int, input().split())
	print('YES' if solve(arr, n, k, l) else 'NO')


rndid = 'utxmdguia'
for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	(*d,) = map(int, input().split())
	p = [*range(0, k), *range(k, 0, -1)]
	k *= 2
	can_get_times = [[*range(k)]]
	for i in range(n - 1, -1, -1):
		times = set()
		for nt in can_get_times[-1]:
			ot = (nt - 1) % k
			if d[i] + p[ot] > l:
				continue
			times.add(ot)
			ott = (ot - 1) % k
			ph = d[i - 1] if i > 0 else -10 ** 9
			while ott != ot and ph + p[ott] <= l and (len(times) < k):
				times.add(ott)
				ott = (ott - 1) % k
			if len(times) == k:
				break
		can_get_times.append(times)
	print('yes' if can_get_times[-1] else 'no')


t = int(input())
for s in range(t):
	(n, k, l) = map(int, input().split())
	a = list(map(int, input().split()))
	(mini, maxi) = ([], [])
	flag = 0
	for i in range(n):
		if a[i] <= l:
			if a[i] + k <= l:
				mini.append(-999999999)
				maxi.append(999999999)
			else:
				mini.append(a[i] - l)
				maxi.append(l - a[i])
		else:
			flag = 1
			break
	if flag == 1:
		print('No')
		continue
	i = 0
	while i < n - 1:
		if mini[i + 1] == -999999999:
			i += 1
		elif mini[i] < 0:
			if mini[i] + 1 > mini[i + 1]:
				mini[i + 1] = mini[i] + 1
		else:
			mini[i + 1] = mini[i] + 1
			if mini[i + 1] > maxi[i + 1]:
				flag = 2
				break
		i += 1
	if flag == 2:
		print('No')
	else:
		print('Yes')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k, l) = [int(x) for x in input().split()]
	p = [i for i in range(k + 1)] + [i for i in range(k - 1, 0, -1)]
	arr = [-k] + [int(x) for x in input().split()]
	n = len(arr)
	s = set()

	def helper(ind, t):
		if ind == n:
			return True
		if arr[ind] + p[t % (2 * k)] > l:
			return False
		if (ind, t % (2 * k)) in s:
			return False
		s.add((ind, t % (2 * k)))
		if helper(ind + 1, t + 1):
			return True
		if helper(ind, t + 1):
			return True
		return False
	if helper(0, 0):
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.buffer.readline

def getAdditionalDepth(t):
	t2 = t % (2 * k)
	if t2 > k:
		t2 = 2 * k - t2
	return t2
t = int(input())
for _ in range(t):
	(n, k, l) = [int(x) for x in input().split()]
	d = [int(x) for x in input().split()]
	ok = True
	for i in range(n):
		d[i] -= l
		if d[i] > 0:
			print('No')
			ok = False
			break
	if ok == False:
		continue
	t = k
	for i in range(-1, n - 1):
		if t >= 2 * k:
			t -= 2 * k
		if d[i + 1] + k <= 0:
			t = k
			continue
		nextDepth = d[i + 1] + getAdditionalDepth(t + 1)
		if nextDepth <= 0:
			t += 1
		elif t < k:
			ok = False
			break
		else:
			t += nextDepth + 1
	if ok:
		print('Yes')
	else:
		print('No')


from sys import stdin

def check(a, b):
	global d, k, l
	arr = [d[a + 1:b]]
	for _ in range(k):
		arr.append(list(map(lambda x: x + 1, arr[-1])))
	for _ in range(k - 1):
		arr.append(list(map(lambda x: x - 1, arr[-1])))
	i = 0
	while i != len(arr):
		j = fl = 0
		while j != len(arr[0]):
			if arr[(i + j) % len(arr)][j] > l:
				fl = 1
				break
			j += 1
			if fl:
				break
		i += 1
		if not fl:
			return 1
	return 0
for _ in range(int(stdin.readline())):
	(n, k, l) = map(int, stdin.readline().split())
	d = list(map(int, stdin.readline().split()))
	safe = [-1]
	for i in range(n):
		if d[i] + k <= l:
			safe.append(i)
	safe.append(n)
	ans = 'YES'
	for i in range(1, len(safe)):
		if not check(safe[i - 1], safe[i]):
			ans = 'NO'
			break
	print(ans)


for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	seg = []
	for i in range(n):
		if l - d[i] < 0:
			print('No')
			break
		seg.append([-min(l - d[i], k), min(l - d[i], k)])
	else:
		now = seg[0][0]
		for i in range(1, n):
			if seg[i] == [-k, k]:
				now = seg[i][0]
			else:
				now += 1
				if now < seg[i][0]:
					now = seg[i][0]
				elif now > seg[i][1]:
					print('No')
					break
		else:
			print('Yes')


def solve():
	(n, k, l) = [int(v) for v in input().split()]
	darr = [int(v) for v in input().split()]
	krr = list(range(k)) + list(reversed(range(1, k + 1)))
	m = len(krr)
	dp = [[True] * m]
	for i in range(n):
		dp.append([False] * m)
		for j in range(m):
			if darr[i] + krr[j] <= l:
				dp[-1][j] |= dp[-2][(j - 1 + m) % m] | dp[-1][(j - 1 + m) % m]
		dp.pop(0)
	if any(dp[-1]):
		print('Yes')
	else:
		print('No')
t = int(input())
for _ in range(t):
	solve()


import sys
input = sys.stdin.readline
for nt in range(int(input())):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	if max(d) > l:
		print('No')
		continue
	dp = [[0 for i in range(2 * k)] for j in range(n)]
	for i in range(k):
		if d[0] + i <= l:
			dp[0][i] = 1
	for i in range(k, 2 * k):
		if d[0] + (2 * k - i) <= l:
			dp[0][i] = 1
	for i in range(1, n):
		for j in range(k):
			if d[i] + j <= l and (dp[i - 1][j - 1] or dp[i][j - 1]):
				dp[i][j] = 1
		for j in range(k, 2 * k):
			if d[i] + (2 * k - j) <= l and (dp[i - 1][j - 1] or dp[i][j - 1]):
				dp[i][j] = 1
	if 1 in dp[-1]:
		print('Yes')
	else:
		print('No')


import sys
readline = sys.stdin.readline

def solve():
	(N, K, L) = map(int, readline().split())
	D = list(map(int, readline().split()))
	if any((d > L for d in D)):
		print('NO')
		return
	k = K + D[0] - L
	for (i, d) in enumerate(D):
		if d + K <= L:
			if i == len(D) - 1:
				break
			k = K + D[i + 1] - L
		else:
			_k = k % (2 * K)
			depth = d + (K - _k if _k <= K else _k - K)
			if depth > L:
				if k < K:
					k = K + d - L
				else:
					print('NO')
					return
			k += 1
	print('YES')
	return
T = int(readline())
for i in range(T):
	solve()


t = int(input())
for s in range(t):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	visited = [[0 for i in range(n + 1)] for j in range(2 * k)]
	shiva = [[0 for i in range(n + 1)] for j in range(2 * k)]
	for i in range(k + 1):
		for j in range(1, n + 1):
			if i == 0:
				shiva[i][j] = d[j - 1]
			else:
				shiva[i][j] = shiva[i - 1][j] + 1
	for i in range(k + 1, 2 * k):
		for j in range(1, n + 1):
			shiva[i][j] = shiva[i - 1][j] - 1
	visited[0][0] = 1
	flag = 0
	i = 0
	while True:
		i = i % (2 * k)
		add = 0
		for j in range(n):
			if visited[i][j] == 1:
				if shiva[(i + 1) % (2 * k)][j] <= l:
					if visited[(i + 1) % (2 * k)][j] == 0:
						visited[(i + 1) % (2 * k)][j] = 1
						add += 1
				if shiva[(i + 1) % (2 * k)][j + 1] <= l:
					if visited[(i + 1) % (2 * k)][j + 1] == 0:
						visited[(i + 1) % (2 * k)][j + 1] = 1
						add += 1
		if add == 0:
			flag = -1
			break
		if visited[(i + 1) % (2 * k)][n] == 1:
			flag = 1
			break
		i += 1
	if flag == -1:
		print('No')
	else:
		print('Yes')


for i in range(int(input())):
	(n, k, l) = map(int, input().split())
	arr = list(map(int, input().split()))
	dp = [[False] * (2 * k) for _ in range(n + 1)]
	p = [i for i in range(k + 1)]
	e = [i for i in range(1, k)]
	p = p + e[::-1]
	for i in range(2 * k):
		dp[0][i] = True
	for i in range(n):
		for t in range(2 * k):
			v = arr[i] + p[(t + 1) % (2 * k)]
			if v <= l:
				dp[i + 1][(t + 1) % (2 * k)] |= dp[i + 1][t]
				dp[i + 1][(t + 1) % (2 * k)] |= dp[i][t]
	ans = False
	for el in dp[-1]:
		ans |= el
	print('Yes' if ans else 'No')


import sys
import heapq
from collections import deque
from collections import defaultdict
I = lambda : list(map(int, input().split(' ')))
for _ in range(int(input())):
	(n, k, l) = I()
	lst = I()
	p = [i for i in range(1 + k)] + [i for i in range(k - 1, 0, -1)]
	dp = [[False for i in range((len(lst) + 1) * k)] for j in range(len(lst))]
	for i in range(len(dp[0])):
		if lst[0] + p[i % (2 * k)] <= l:
			dp[0][i] = True
	for i in range(1, len(dp)):
		for j in range(len(dp[0])):
			dp[i][j] = (dp[i - 1][j - 1] or dp[i][j - 1]) and lst[i] + p[j % (2 * k)] <= l
	if any(dp[-1]):
		print('YES')
	else:
		print('NO')


ans = []
for _ in range(int(input())):
	(n, k, L) = map(int, input().split())
	u = list(map(int, input().split()))
	x = 0
	for d in u:
		z = L - d
		if z < 0:
			ans.append('No')
			break
		if z >= k:
			x = 0
		elif x < k:
			x = max(x + 1, k - z)
		elif x >= k:
			x += 1
			if x - k > z:
				ans.append('No')
				break
	else:
		ans.append('Yes')
print('\n'.join(ans))


t = int(input())
for i in range(t):
	(n, k, l) = map(int, input().split())
	b = list(map(int, input().split()))
	p = []
	j = 0
	while j < k:
		p.append(j)
		j += 1
	c = p + [k] + p[::-1]
	j = 0
	f = 0
	if b[0] > l:
		f = 1
	j = 1
	pr = 0
	m = 1
	while j < n:
		if b[j] + k <= l:
			m = 1
			pass
		else:
			if b[j] > l:
				f = 1
				break
			if b[j - 1] + k <= l:
				pr = 0
				m = 1
			else:
				if pr == 0:
					q = l
					s = 0
					while q >= b[j]:
						if q - (b[j] - b[j - 1]) + 1 <= l:
							s = 1
							break
						q += -1
					if s == 0:
						q = b[j]
						while q <= l:
							if q - (b[j] - b[j - 1]) - 1 >= l:
								s = 1
								break
							q += 1
						m = 0
					if s == 0:
						f = 1
						break
					curr = q
					pr = 1
					if m == 1 and curr == b[j]:
						m = 0
				else:
					s = 0
					if m == 0:
						q = b[j]
						while q <= l:
							if q - (b[j] - b[j - 1]) - 1 >= curr:
								s = 1
								break
							q += 1
					else:
						q = l
						while q >= b[j]:
							if q - (b[j] - b[j - 1]) + 1 <= curr:
								s = 1
								break
							q += -1
					if s == 0:
						f = 1
						break
					curr = q
				if m == 1 and curr == b[j]:
					m = 0
		j += 1
	if f == 0:
		print('Yes')
	else:
		print('No')


def ans(lol, t):
	if lol == n + 1:
		return 1
	if l1[t % (2 * k)] + l[lol - 1] <= d and t <= 4 * n * (k + 1):
		return max(ans(lol + 1, t + 1), ans(lol, t + 1))
	elif lol == 0 and t <= 2 * k:
		return ans(lol, t + 1)
	else:
		return 0
for _ in range(int(input())):
	(n, k, d) = map(int, input().split())
	l = list(map(int, input().split()))
	l1 = []
	dd = []
	for i in range(k + 1):
		l1.append(i)
	for i in range(k - 1, 0, -1):
		l1.append(i)
	dp = []
	for i in range(n + 1):
		for j in range(2 * n * k + 1):
			dd.append(0)
		dp.append(dd)
		dd = []
	for i in range(1, n + 1):
		for j in range(1, 2 * n * k + 1):
			if i == 1 or j == 1:
				if j >= i:
					if l1[j % (2 * k)] + l[i - 1] <= d:
						dp[i][j] = 1
			elif l1[j % (2 * k)] + l[i - 1] <= d:
				dp[i][j] = max(dp[i - 1][j - 1], dp[i][j - 1])
	rr = max(dp[n])
	if rr == 1:
		print('Yes')
	else:
		print('No')


from sys import stdin, stdout

def arrinp():
	return [*map(int, stdin.readline().split(' '))]

def mulinp():
	return map(int, stdin.readline().split(' '))

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

def inp():
	return stdin.readline()

def solution():
	(n, k, l) = mulinp()
	d = [0] + arrinp()
	if max(d) > l:
		print('No')
		return
	impflag = 0
	free = [0] * (n + 2)
	for i in range(n + 1):
		depth = d[i]
		if depth + k <= l:
			free[i] = 1
	free[0] = 1
	free[n + 1] = 1
	t = 0
	for i in range(n + 2):
		if free[i]:
			t = 0
		else:
			t += 1
			if t > k:
				if t - k + d[i] > l:
					impflag = 1
					break
			elif k - t + d[i] > l:
				t += k - t + d[i] - l
	if impflag == 0:
		print('Yes')
	else:
		print('No')
testcases = 1
testcases = intinp()
for _ in range(testcases):
	solution()


import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

def solve(lst, k, l):
	console('----- solving ------')
	lst = [l - x for x in lst]
	console(k, lst)
	jigsaw = []
	for _ in range(len(lst) // k + 1):
		jigsaw += list(range(k)) + list(range(k, 0, -1))
	console(jigsaw)
	depth = lst
	console('check')
	called = set()

	def dfs(x, t):
		if x == len(lst):
			return True
		if x >= 0 and depth[x] - jigsaw[t] < 0:
			return False
		if dfs(x + 1, (t + 1) % (2 * k)):
			return True
		if (x, t) in called:
			return False
		called.add((x, t))
		if dfs(x, (t + 1) % (2 * k)):
			return True
		return False
	if dfs(-1, 1):
		return 'Yes'
	return 'No'

def console(*args):
	return
for case_num in range(int(input())):
	(_, k, l) = list(map(int, input().split()))
	lst = list(map(int, input().split()))
	res = solve(lst, k, l)
	print(res)


import sys
import math
input = sys.stdin.readline
T = int(input())
for t in range(T):
	(N, k, limit) = map(int, input().split(' '))
	A = list(map(int, input().split(' ')))
	A.append(-1000000)
	tide = list(range(k + 1)) + list(range(k - 1, 0, -1))
	C = [[True]]
	can = False
	for i in range(1, (N + 1) * k * 2):
		max_dist = min(i, N + 1)
		C.append([False for j in range(max_dist + 1)])
		C[i][0] = True
		for j in range(1, max_dist + 1):
			depth = A[j - 1] + tide[i % len(tide)]
			if depth <= limit:
				if j < len(C[i - 1]):
					C[i][j] |= C[i - 1][j]
				C[i][j] |= C[i - 1][j - 1]
				if j + 1 < len(C[i - 1]):
					C[i][j] |= C[i - 1][j + 1]
				if C[i][j] and j == N + 1:
					can = True
		if can:
			break
	print('Yes' if can else 'No')


f = lambda : map(int, input().split())
(t,) = f()
for _ in [0] * t:
	(n, k, l) = f()
	s = [*f()]
	a = 0
	z = k - 1
	for i in s:
		if i + k <= l:
			z = k - 1
		elif z >= 0 and l >= i:
			z = min(z, l - i) - 1
		elif l < i or abs(z) > l - i:
			a = 1
		else:
			z -= 1
	print('YNeos'[a::2])


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop, heapify
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

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

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
l1 = k = n = 0
l = []

def givedepth(d, time):
	global k
	time %= 2 * k
	if time <= k:
		return d + time
	return d + 2 * k - time
for _ in range(val()):
	(n, k, l1) = li()
	l = li()

	@lru_cache(None)
	def rec(i, time):
		global n, l, l1
		if i == n + 1:
			rec.ans = 1
			return 0
		if givedepth(l[i - 1], time) > l1:
			return 0
		for j in range(2 * k):
			rec(i + 1, (time + 1 + j) % (2 * k))
			if givedepth(l[i - 1], time + 1 + j) > l1:
				return 0
		return 0
	rec.ans = 0
	for i in range(2 * k):
		rec(1, i)
	print('YES' if rec.ans else 'NO')


for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	ls = list(map(int, input().split()))
	dp = [[[False for i in range(2)] for j in range(k + 1)] for m in range(n)]
	p = [i for i in range(k + 1)]
	for i in range(k - 1, 0, -1):
		p.append(i)
	for i in range(n):
		for j in range(2 * k):
			if j < k:
				down = 0
			else:
				down = 1
			dp[i][p[j]][down] = ls[i] + p[j] <= l
	f = -1
	for j in range(2 * k):
		if 0 <= j < k:
			down1 = 0
		else:
			down1 = 1
		if not dp[0][p[j]][down1]:
			continue
		stack = [[0, p[j], down1]]
		while stack:
			elem = stack.pop()
			dp[elem[0]][elem[1]][elem[2]] = False
			nxt = elem[0] + 1
			f = max(elem[0], f)
			if f == n - 1:
				break
			if elem[1] == 1 and elem[2]:
				tide = 0
				down = 0
			elif elem[2] == 0 and elem[1] == k - 1:
				tide = k
				down = 1
			else:
				down = elem[2]
				if down:
					tide = elem[1] - 1
				else:
					tide = elem[1] + 1
			if dp[nxt][tide][down]:
				stack.append([nxt, tide, down])
			if dp[elem[0]][tide][down]:
				stack.append([elem[0], tide, down])
	if f == n - 1:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	D = list(map(int, input().split()))
	P = list(range(k)) + list(range(k, 0, -1))
	V = [[False] * (2 * k) for _ in range(n)]
	Q = []
	for t in range(2 * k):
		V[0][t] = True
		Q.append((0, t))
	for (i, t) in Q:
		if D[i] + P[t] > l:
			continue
		if i == n - 1:
			print('Yes')
			break
		nt = (t + 1) % (2 * k)
		if not V[i][nt]:
			V[i][nt] = True
			Q.append((i, nt))
		if not V[i + 1][nt]:
			V[i + 1][nt] = True
			Q.append((i + 1, nt))
	else:
		print('No')


import sys
import math
input = sys.stdin.readline
T = int(input())
for t in range(T):
	(N, k, limit) = map(int, input().split(' '))
	A = list(map(int, input().split(' ')))
	lowest_tide = k
	tide = k
	time = 0
	can = True
	for i in range(N):
		if A[i] > limit:
			can = False
			break
		if A[i] + k <= limit:
			time = 0
			tide = k
		else:
			if time < k:
				min_step = max(A[i] + tide - limit, 1)
				tide -= min_step
				time += min_step
			else:
				tide += 1
				time += 1
			if A[i] + tide > limit or tide < 0:
				can = False
				break
	print('Yes' if can else 'No')


mod = 1000000007
eps = 10 ** (-9)

def main():
	import sys
	input = sys.stdin.buffer.readline
	for _ in range(int(input())):
		(N, K, L) = map(int, input().split())
		A = list(map(int, input().split()))
		A.append(-K)
		if max(A) > L:
			print('No')
			continue
		ok = 1
		k = -K - 1
		for a in A:
			k += 1
			if k < 0:
				if a + K <= L:
					k = -K - 1
				if a - k > L:
					k = -(L - a)
			elif a + k > L:
				ok = 0
				break
			elif a + K <= L:
				k = -K - 1
		if ok:
			print('Yes')
		else:
			print('No')
main()


T = int(input())

def solve(N, K, L, D):
	P = []
	for p in range(K + 1):
		P.append(p)
	for p in range(K - 1, 0, -1):
		P.append(p)
	dp = [[False for t in range(2 * K)] for n in range(N)]
	for x in range(2 * K):
		depth = D[0] + P[x]
		if depth <= L:
			dp[0][x] = True
	for n in range(1, N):
		for x in range(2 * K):
			depth = D[n] + P[x]
			if dp[n - 1][(x - 1) % (2 * K)] and depth <= L:
				dp[n][x] = True
		for j in range(2 * K):
			if dp[n][j]:
				x = j * 1
				count = 0
				while D[n] + P[(x + 1) % (2 * K)] <= L and count < 2 * K:
					dp[n][(x + 1) % (2 * K)] = True
					x += 1
					count += 1
	for x in range(2 * K):
		if dp[N - 1][x]:
			return 'Yes'
	return 'No'
for t in range(1, T + 1):
	(N, K, L) = [int(s) for s in input().split()]
	D = [int(s) for s in input().split()]
	print(solve(N, K, L, D))


from collections import deque
import sys
input = sys.stdin.readline

def bfs():
	q = deque()
	visit = [0] * (n * k2 + 1)
	for i in range(k2):
		if dd[i] <= l:
			q.append(i)
			visit[i] = 1
	while q:
		i = q.popleft()
		if i // k2 == n - 1:
			return True
		j = i + 1 if (i + 1) % k2 else i - k2 + 1
		if not visit[j] and dd[j] <= l:
			visit[j] = 1
			q.append(j)
		j = i + k2 + 1 if (i + 1) % k2 else i + 1
		if not visit[j] and dd[j] <= l:
			visit[j] = 1
			q.append(j)
	return False
t = int(input())
for _ in range(t):
	(n, k, l) = map(int, input().split())
	k2 = 2 * k
	d = list(map(int, input().split()))
	dd = []
	for i in d:
		j = i
		for _ in range(k):
			dd.append(j)
			j += 1
		for _ in range(k):
			dd.append(j)
			j -= 1
	ok = bfs()
	ans = 'Yes' if ok else 'No'
	print(ans)


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

def gift():
	for _ in range(t):
		(n, k, l) = list(map(int, input().split()))
		arry = list(map(int, input().split()))
		prevdis = float('inf')
		increase = False
		for val in arry:
			if val > l:
				break
			dis = l - val
			if dis >= k:
				prevdis = dis
				increase = False
				continue
			if increase:
				if dis >= prevdis + 1:
					prevdis += 1
				else:
					break
			else:
				prevdis = min(prevdis - 1, dis)
				if prevdis == 0:
					increase = True
		else:
			yield 'Yes'
			continue
		yield 'No'
t = int(input())
ans = gift()
print(*ans, sep='\n')


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
T = int(input())
for _ in range(T):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	ranges = []
	t = -102
	co = 0
	for i in range(n):
		ch = [max(t + 1, -l + d[i]), l - d[i]]
		t = max(-l + d[i], t + 1)
		if k <= l - d[i]:
			ch = [-102, 102]
			t = -101
		ranges.append(ch)
		if ranges[i][0] > ranges[i][1]:
			print('NO')
			co = 1
			break
	if co == 0:
		print('YES')


import sys
from collections import defaultdict as dd
from collections import deque
from functools import *
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from math import *
from itertools import permutations

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

def inc(d, c):
	d[c] = d[c] + 1 if c in d else 1

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for x in input().split()]

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

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

def gh():
	sys.stdout.flush()

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)

def bo(i):
	return ord(i) - ord('a')
t = fi()

def solve(i, time):
	if i == n + 1:
		dp[i][time % (2 * k)] = True
		return True
	if dp[i][time % (2 * k)] != -1:
		return dp[i][time % (2 * k)]
	if d[i] + p[time % (2 * k)] > l:
		dp[i][time % (2 * k)] = False
		return False
	for j in range(1, 2 * k + 1):
		if solve(i + 1, time + j):
			dp[i][time % (2 * k)] = True
			return True
		if i != 0 and d[i] + p[(time + j) % (2 * k)] > l:
			dp[i][time % (2 * k)] = False
			return False
	dp[i][time % (2 * k)] = False
	return False
while t > 0:
	t -= 1
	(n, k, l) = mi()
	d = li()
	p = []
	d.insert(0, 0)
	dp = [[-1 for i in range(2 * k + 1)] for j in range(n + 2)]
	for i in range(k + 1):
		p.append(i)
	for i in range(k - 1, -1, -1):
		p.append(i)
	print('Yes' if solve(0, 0) else 'No')


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

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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

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

def N():
	return int(input())

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

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def toord(c):
	return ord(c) - ord('a')

def lcm(a, b):
	return a * b // lcm(a, b)
mod = 998244353
INF = float('inf')
from math import factorial, sqrt, ceil, floor, gcd
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	for _ in range(N()):
		(n, k, l) = RL()
		arr = RLL()
		tm = 1000
		p = [i for i in range(k + 1)] + [i for i in range(k - 1, 0, -1)]
		dp = [[False] * tm for _ in range(n + 1)]
		dp[0] = [True] * tm
		for i in range(1, n + 1):
			for j in range(1, tm):
				now = arr[i - 1] + p[j % (2 * k)]
				if now > l:
					continue
				if dp[i][j - 1]:
					dp[i][j] = True
				dp[i][j] = dp[i][j] or dp[i - 1][j - 1]
		print('Yes' if True in dp[i] else 'No')
main()


for h in range(int(input())):
	(n, k, l) = map(int, input().strip().split())
	arr = list(map(int, input().strip().split()))
	dp = [0 for i in range(len(arr) + 1)]
	dp[0] = -1
	there = True
	for i in range(len(arr)):
		if arr[i] > l:
			there = False
			break
		elif arr[i] + k > l:
			dp[i + 1] = arr[i]
		else:
			dp[i + 1] = -1
	if there == False:
		print('No')
		continue
	pointer = 0
	for i in range(n + 1):
		if dp[i] == -1:
			if i == n:
				continue
			elif i < n:
				maxi = l - dp[i + 1]
				pointer = -maxi - 1
		else:
			pointer += 1
			if dp[i] + abs(pointer) > l:
				if pointer >= 0:
					there = False
					break
				else:
					pointer = -(l - dp[i])
	if there == False:
		print('No')
	else:
		print('Yes')


t = int(input())
for prroldg in range(t):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	mas = [0] * n
	for i in range(n):
		z = l - d[i]
		if z < 0:
			mas[i] = [0] * (2 * k)
		elif z > k - 1:
			mas[i] = [1] * (2 * k)
		else:
			mas[i] = [0] * (k - z) + [1] * (2 * z + 1) + [0] * (k - z - 1)
	for i in range(1, n):
		for j in range(2 * k):
			if mas[i][j] == 1:
				if j == 0:
					mas[i][j] = max(mas[i][2 * k - 1], mas[i - 1][2 * k - 1])
				else:
					mas[i][j] = max(mas[i][j - 1], mas[i - 1][j - 1])
			if mas[i - 1] == [0] * (2 * k):
				mas[i] = [0] * (2 * k)
	a = max(mas[-1])
	if a == 0:
		print('No')
	else:
		print('Yes')


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

def bfs():
	q = deque([])
	dist = [-1] * (n * 2 * k)
	for i in range(2 * k):
		q.append(i)
		dist[i] = 0
	while q:
		v = q.popleft()
		for nv in G[v]:
			if dist[nv] == -1:
				dist[nv] = dist[v] + 1
				q.append(nv)
	for i in range(2 * k):
		if dist[(n - 1) * 2 * k + i] != -1:
			return True
	return False
for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	d = list(map(int, input().split()))
	G = [[] for _ in range(n * 2 * k)]
	p = [i for i in range(k + 1)] + [i for i in range(k - 1, 0, -1)]
	for i in range(n):
		for j in range(2 * k):
			if d[i] + p[j] <= l and d[i] + p[(j + 1) % (2 * k)] <= l:
				G[i * 2 * k + j].append(i * 2 * k + (j + 1) % (2 * k))
		if i + 1 < n:
			for j in range(2 * k):
				if d[i] + p[j] <= l and d[i + 1] + p[(j + 1) % (2 * k)] <= l:
					G[i * 2 * k + j].append((i + 1) * 2 * k + (j + 1) % (2 * k))
	if bfs():
		print('Yes')
	else:
		print('No')


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

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def dfs(graph, start=0):
	n = len(graph)
	dp = [0] * n
	(visited, finished) = ([False] * n, [False] * n)
	stack = [start]
	while stack:
		start = stack[-1]
		if not visited[start]:
			visited[start] = True
			for child in graph[start]:
				if not visited[child]:
					stack.append(child)
		else:
			stack.pop()
			dp[start] += 1
			for child in graph[start]:
				if finished[child]:
					dp[start] += dp[child]
			finished[start] = True
	return visited
for _ in range(int(input()) if True else 1):
	(n, k, l) = map(int, input().split())
	a = list(map(int, input().split()))
	p = [i for i in range(k)] + [i for i in range(k, 0, -1)]
	graph = [[] for __ in range(2 * k * n + 1 + 1)]

	def add_edge(x, y):
		graph[x] += [y]
	for i in range(n - 1):
		for j in range(2 * k):
			if a[i] + p[j % (2 * k)] <= l:
				if a[i] + p[(j + 1) % (2 * k)] <= l:
					add_edge(i * 2 * k + j + 1, i * 2 * k + (j + 1) % (2 * k) + 1)
				if a[i + 1] + p[(j + 1) % (2 * k)] <= l:
					add_edge(i * 2 * k + j + 1, (i + 1) * 2 * k + (j + 1) % (2 * k) + 1)
	for j in range(2 * k):
		if a[-1] + p[j % (2 * k)] <= l:
			add_edge((n - 1) * 2 * k + j + 1, 2 * k * n + 1)
	pos = False
	for j in range(2 * k):
		vis = dfs(graph, j + 1)
		if vis[-1]:
			pos = True
			break
	print('YES' if pos else 'NO')


import sys
input = sys.stdin.readline

def solve(depths, pos, l, p, pPos, k, n):
	ans = False
	if p[pPos % (2 * k)] + depths[pos] > l:
		return False
	if dp[pos][pPos % (2 * k)] != -1:
		return dp[pos][pPos % (2 * k)]
	if pos == n - 1:
		return True
	for i in range(pPos, 2 * k + pPos):
		temp = i % (2 * k)
		if p[temp] + depths[pos] > l:
			break
		ans = ans or solve(depths, pos + 1, l, p, temp + 1, k, n)
	dp[pos][pPos % (2 * k)] = ans
	return ans
for _ in range(int(input())):
	(n, k, l) = map(int, input().split())
	depths = list(map(int, input().split()))
	p = []
	for i in range(k + 1):
		p.append(i)
	for i in range(k - 1, 0, -1):
		p.append(i)
	dp = [[-1 for _ in range(2 * k)] for _ in range(n)]
	ans = False
	for i in range(2 * k):
		ans = ans or solve(depths, 0, l, p, i, k, n)
	print('Yes' if ans else 'No')


from sys import stdin, stdout
import math
t = int(stdin.readline())
for _ in range(t):
	(n, k, l) = map(int, stdin.readline().split())
	d = [-k] + list(map(int, stdin.readline().split())) + [-k]
	t = 0
	for i in range(n + 1):
		x = d[i]
		cur = t % (2 * k)
		curth = cur if cur <= k else k - (cur - k)
		if x > l or x + curth > l:
			break
		nx = d[i + 1]
		best = 2 * k - (l - nx)
		if best < k:
			best = k
		if cur < k:
			if best == k:
				if x + k - 1 > l:
					t += 1
					continue
			elif x + k > l:
				t += 1
				continue
		elif best <= cur:
			if x + k > l:
				t += 1
				continue
		t = best
		t %= 2 * k
	else:
		print('YES')
		continue
	print('NO')


import copy
t = int(input())
for tt in range(t):
	ok = True
	vis = set()
	(n, k, l) = map(int, input().split())
	a = list(map(int, input().split()))
	a.insert(0, 0)
	now = -k
	for i in range(1, n + 1):
		if a[i] > l:
			ok = False
			break
		if a[i] + k <= l:
			now = -k
			continue
		if abs(now) + a[i] > l:
			if now >= 0:
				ok = False
				break
			now = -(l - a[i])
		now += 1
	if ok:
		print('Yes')
	else:
		print('No')


t = int(input())
for _ in range(t):
	(n, k, l) = [int(x) for x in input().split()]
	d = [int(x) for x in input().split()]
	p = list(range(k)) + list(range(k, 0, -1))

	def getDepth(i, t):
		return d[i] + p[t]
	memo = [[None for _ in range(2 * k)] for __ in range(n)]

	def dp(i, t):
		if i == n:
			return True
		if memo[i][t] == None:
			t2 = t + 1
			ok = False
			while True:
				if t2 == 2 * k:
					t2 = 0
				if getDepth(i, t2) > l:
					break
				if dp(i + 1, t2) == True:
					ok = True
				if t2 == t:
					break
				t2 += 1
			memo[i][t] = ok
		return memo[i][t]
	ok = False
	for t in range(2 * k):
		if dp(0, t):
			ok = True
			break
	if ok:
		print('Yes')
	else:
		print('No')