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

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')


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))


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')


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')


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')


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 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')


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')


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')


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')


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()


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
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')


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')


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')


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 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')


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')


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')


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 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])


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 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

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')


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')