There are N hills in a row numbered 1 through N from left to right. Each hill has a height; for each valid i, the height of the i-th hill is Hi. Chef is initially on the leftmost hill (hill number 1). He can make an arbitrary number of jumps (including zero) as long as the following conditions are satisfied:

- Chef can only jump from each hill to the next hill, i.e. from the i-th hill, he can jump to the i+1-th hill (if it exists).
- It's always possible to jump to a hill with the same height as the current hill.
- It's possible to jump to a taller hill if it's higher than the current hill by no more than U.
- It's possible to jump to a lower hill if it's lower than the current hill by no more than D.
- Chef can use a parachute and jump to a lower hill regardless of its height (as long as it's lower than the current hill). This jump can only be performed at most once.

Chef would like to move as far right as possible. Determine the index of the rightmost hill Chef can reach.

-----Input-----
- The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
- The first line of each test case contains three space-separated integers N, U and D.
- The second line contains N space-separated integers H1, H2, ..., HN.

-----Output-----
For each test case, print a single line containing one integer — the index of the rightmost reachable hill.

-----Constraints-----
- 1 ≤ T ≤ 100
- 1 ≤ N ≤ 100
- 1 ≤ U, D ≤ 1,000,000
- 1 ≤ Hi ≤ 1,000,000 for each valid i

-----Subtasks-----
Subtask #1 (100 points): original constraints

-----Example-----
Input:

3
5 3 2
2 5 2 6 3
5 2 3
4 4 4 4 4
5 2 7
1 4 3 2 1

Output:

3
5
1

-----Explanation-----
Example case 1: Chef can jump to second hill because it's higher by no more than U=3 than first hill, to jump to third hill Chef has to use parachute 
because it's lower than second hill by 3 which is more than D=2, Chef can't jump to fourth hill because it's higher than third hill by 4 which is more than U=3
Example case 2: All hills are of the same height, so chef can reach the last hill with no problems.
Example case 3: Chef can't jump to second hill because it's too high for him

Difficulty: EASY
Tags: Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
for _ in range(int(input())):
	(n, u, d) = map(int, input().split())
	H = list(map(int, input().split()))
	parachute = 1
	lenH = len(H)
	for i in range(lenH):
		if i == lenH - 1:
			break
		if H[i + 1] > H[i]:
			if H[i + 1] - H[i] > u:
				break
		elif H[i + 1] < H[i]:
			if H[i] - H[i + 1] > d:
				if parachute == 1:
					parachute = 0
					continue
				else:
					break
	print(i + 1)


for tc in range(int(input())):
	(N, U, D) = map(int, input().split())
	H = list(map(int, input().split()))
	count = 0
	check = 0
	for i in range(N - 1):
		if H[i] == H[i + 1] or (H[i] < H[i + 1] and H[i + 1] - H[i] <= U):
			count += 1
		elif H[i] - H[i + 1] > 0:
			if H[i] - H[i + 1] <= D:
				count += 1
			elif check == 0:
				count += 1
				check += 1
			else:
				break
		else:
			break
	print(count + 1)


t = int(input())
for i in range(t):
	NUD = list(map(int, input().split()))
	U = NUD[1]
	D = NUD[2]
	H = list(map(int, input().split()))
	c = 1
	k = 1
	for j in range(0, len(H) - 1):
		if H[j] < H[j + 1]:
			up = H[j + 1] - H[j]
			if up > U:
				break
			else:
				c += 1
		elif H[j] > H[j + 1]:
			down = H[j] - H[j + 1]
			if down <= D:
				c += 1
			elif k == 1:
				c += 1
				k = 0
			else:
				break
		elif H[j] == H[j + 1]:
			c += 1
	print(c)


t = int(input())
for i in range(t):
	(n, u, d) = map(int, input().split())
	l = list(map(int, input().split()))
	count = 1
	parcht = 0
	for j in range(n - 1):
		if l[j] < l[j + 1]:
			if l[j + 1] - l[j] <= u:
				count += 1
			else:
				break
		elif l[j] > l[j + 1]:
			if l[j] - l[j + 1] <= d:
				count += 1
			elif parcht == 0:
				count += 1
				parcht = 1
			else:
				break
		else:
			count += 1
	print(count)


for y in range(int(input())):
	(n, u, d) = map(int, input().split())
	h = list(map(int, input().split()))
	count = 0
	para = 1
	for i in range(1, len(h)):
		if -d <= h[i] - h[i - 1] <= u:
			count += 1
		elif para and h[i] < h[i - 1]:
			para -= 1
			count += 1
		else:
			break
	print(count + 1)


standard_input = '3\n7 3 2\n2 5 1 2 3 4 1\n5 2 3\n4 4 4 4 4\n5 2 7\n1 4 3 2 1'
for _ in range(int(input())):
	(n, u, d) = map(int, input().split())
	d = -1 * d
	hill = list(map(int, input().split()))
	jump = 1
	para = 1
	for i in range(n - 1):
		if hill[i + 1] - hill[i] < d:
			if para == 0:
				break
			jump += 1
			para = 0
			continue
		if hill[i + 1] - hill[i] <= u:
			jump += 1
		else:
			break
	print(jump)


for i in range(int(input())):
	(n, u, d) = map(int, input().split())
	l = list(map(int, input().split()))
	cnt = 1
	para = 0
	for j in range(1, len(l)):
		if 0 <= l[j] - l[j - 1] <= u or 0 <= l[j - 1] - l[j] <= d:
			cnt += 1
		elif l[j - 1] - l[j] > d and para == 0:
			cnt += 1
			para += 1
		else:
			break
	print(cnt)


try:
	for _ in range(int(input())):
		(n, u, d) = map(int, input().split())
		l = list(map(int, input().split()))
		a = 1
		b = True
		for i in range(n - 1):
			if l[i] < l[i + 1] and l[i] + u >= l[i + 1]:
				continue
			elif l[i] > l[i + 1] and l[i] <= l[i + 1] + d:
				continue
			elif l[i] == l[i + 1]:
				continue
			elif a == 1 and l[i] > l[i + 1]:
				a -= 1
				continue
			else:
				b = False
				break
		if not b:
			print(i + 1)
		else:
			print(n)
except:
	pass


for text in range(int(input())):
	(n, u, d) = map(int, input().split())
	l = list(map(int, input().split()))
	a = 1
	b = True
	for i in range(n - 1):
		if l[i] < l[i + 1] and l[i] + u >= l[i + 1]:
			continue
		elif l[i] > l[i + 1] and l[i] <= l[i + 1] + d:
			continue
		elif l[i] == l[i + 1]:
			continue
		elif a == 1 and l[i] > l[i + 1]:
			a -= 1
			continue
		else:
			b = False
			break
	if b == False:
		print(i + 1)
	else:
		print(n)


for _ in range(int(input())):
	(n, u, d) = map(int, input().split())
	a = list(map(int, input().split()))
	x = 1
	count = 1
	for i in range(n - 1):
		if a[i] <= a[i + 1]:
			if a[i] + u >= a[i + 1]:
				count += 1
			elif a[i] + u < a[i + 1]:
				break
		elif a[i] - d <= a[i + 1]:
			count += 1
		elif x == 1:
			count += 1
			x = 0
		else:
			break
	print(count)


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	d = list(map(int, input().split()))
	e = 0
	m = 0
	for i in range(a - 1):
		if d[i] == d[i + 1]:
			e += 1
		elif d[i] > d[i + 1]:
			if d[i] - d[i + 1] <= c:
				e += 1
			elif m == 0:
				e += 1
				m += 1
			else:
				break
		elif d[i + 1] - d[i] <= b:
			e += 1
		else:
			break
	print(e + 1)


n = int(input())
for i in range(n):
	(N, U, D) = [int(i) for i in input().split()]
	Heights = [int(i) for i in input().split()]
	i = 0
	p = 1
	while i + 1 <= N - 1:
		if Heights[i + 1] > Heights[i]:
			if Heights[i + 1] - Heights[i] <= U:
				i += 1
			else:
				break
		elif Heights[i + 1] < Heights[i]:
			if Heights[i] - Heights[i + 1] <= D:
				i += 1
			elif p:
				i += 1
				p = 0
			else:
				break
		else:
			i += 1
	print(i + 1)


for _ in range(int(input())):
	(N, U, D) = map(int, input().split())
	H = list(map(int, input().split()))
	canUseParachute = True
	index = 0
	if len(set(H)) == 1:
		print(len(H))
	else:
		for h in H[1:]:
			diff = H[index] - h
			if diff <= 0 and abs(diff) <= U:
				index += 1
			elif diff > 0 and diff <= D:
				index += 1
			elif canUseParachute and diff > 0:
				index += 1
				canUseParachute = False
			else:
				break
		print(index + 1)


for _ in range(int(input())):
	(N, U, D) = map(int, input().split(' '))
	H = list(map(int, input().split(' ')))
	count = 1
	para = 0
	for i in range(N - 1):
		if H[i + 1] <= H[i] and H[i] - H[i + 1] > D and (para == 0):
			count += 1
			para += 1
		elif H[i + 1] <= H[i] and H[i] - H[i + 1] > D and (para != 0):
			break
		elif H[i + 1] <= H[i] and H[i] - H[i + 1] <= D:
			count += 1
		elif H[i + 1] >= H[i] and H[i + 1] - H[i] <= U:
			count += 1
		else:
			break
	print(count)


t = int(input())
for i in range(t):
	n_u_d = input().split(' ')
	hills = input().split(' ')
	(n, u, d, index_h, p) = (int(n_u_d[0]), int(n_u_d[1]), int(n_u_d[2]), 1, 1)
	for j in range(n - 1):
		if int(hills[j]) <= int(hills[j + 1]) and int(hills[j + 1]) - int(hills[j]) <= u:
			index_h += 1
		elif int(hills[j]) > int(hills[j + 1]) and int(hills[j]) - int(hills[j + 1]) <= d:
			index_h += 1
		elif int(hills[j]) > int(hills[j + 1]) and p == 1:
			(index_h, p) = (index_h + 1, p - 1)
		else:
			break
	print(index_h)


for t in range(int(input())):
	(n, u, d) = map(int, input().split())
	l = list(map(int, input().split()))
	temp = l[0]
	(count, parachute) = (0, 1)
	for num in l:
		if num >= temp and num - temp <= u:
			temp = num
			count += 1
		elif num < temp and temp - num <= d:
			temp = num
			count += 1
		elif num < temp and parachute == 1:
			parachute = 0
			count += 1
			temp = num
		else:
			break
	print(count)


for _ in range(int(input())):
	(n, u, d) = map(int, input().split())
	h = list(map(int, input().strip().split()))
	ans = n
	parachute = 1
	for i in range(n - 1):
		if h[i] == h[i + 1]:
			continue
		elif h[i] < h[i + 1]:
			if h[i + 1] - h[i] <= u:
				continue
			else:
				ans = i + 1
				break
		elif h[i] - h[i + 1] <= d:
			continue
		elif parachute == 1:
			parachute -= 1
			continue
		else:
			ans = i + 1
			break
	print(ans)


T = int(input())
for i in range(T):
	(N, U, D) = map(int, input().split())
	H = list(map(int, input().split()))
	L_CHANCE = 1
	JUMPS = 0
	for j in range(N - 1):
		if H[j] == H[j + 1]:
			JUMPS += 1
		elif H[j + 1] > H[j] and H[j + 1] - H[j] <= U:
			JUMPS += 1
		elif H[j + 1] < H[j] and H[j] - H[j + 1] <= D:
			JUMPS += 1
		elif H[j + 1] < H[j] and H[j] - H[j + 1] > D and (L_CHANCE > 0):
			JUMPS += 1
			L_CHANCE -= 1
		else:
			break
	print(JUMPS + 1)


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	l = list(map(int, input().split()))
	co = 1
	x = 0
	for j in range(a - 1):
		if l[j] == l[j + 1]:
			co += 1
		elif l[j] < l[j + 1]:
			if l[j + 1] - l[j] <= b:
				co += 1
			else:
				break
		elif l[j] > l[j + 1]:
			if l[j] - l[j + 1] <= c:
				co += 1
			elif x == 0:
				co += 1
				x = 1
			else:
				break
		else:
			break
	print(co)


for _ in range(int(input())):
	(n, u, d) = map(int, input().split())
	h = list(map(int, input().split()))
	ps = False
	ans = 1
	for i in range(n - 1):
		if h[i] == h[i + 1] or (h[i + 1] - h[i] > 0 and h[i + 1] - h[i] <= u) or (h[i] - h[i + 1] <= d and h[i] - h[i + 1] > 0):
			ans += 1
		elif ps == False and h[i] > h[i + 1]:
			ans += 1
			ps = True
		else:
			break
	print(ans)


t = int(input())
for _ in range(t):
	(n, m, p) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	para = True
	final = 0
	for i in range(n - 1):
		if a[i + 1] > a[i] + m:
			break
		elif a[i + 1] < a[i] - p:
			if para:
				para = False
			else:
				break
		final = i + 1
	print(final + 1)


for i in range(int(input())):
	(N, U, D) = map(int, input().split())
	z = list(map(int, input().split()))
	count = 0
	c = 0
	for i in range(N - 1):
		if z[i] < z[i + 1] and z[i + 1] - z[i] <= U:
			count = count + 1
		elif z[i] > z[i + 1] and z[i] - z[i + 1] <= D:
			count = count + 1
		elif z[i] > z[i + 1] and z[i] - z[i + 1] > D and (c < 1):
			count = count + 1
			c = c + 1
		elif z[i] == z[i + 1]:
			count = count + 1
		else:
			break
	print(count + 1)


t = int(input())
for i in range(t):
	(n, u, d) = map(int, input().split())
	h = list(map(int, input().split()))
	c = 0
	num = h[0]
	para = 1
	for j in h:
		if j >= num and j - num <= u:
			c += 1
			num = j
		elif j <= num and num - j <= d:
			c += 1
			num = j
		elif j <= num and para == 1:
			c += 1
			para = 0
			num = j
		else:
			break
	print(c)


for _ in range(int(input())):
	(n, u, d) = map(int, input().split())
	l = list(map(int, input().split()))
	x = 1
	m = 0
	for i in range(n - 1):
		if l[i] <= l[i + 1] and l[i + 1] - l[i] <= u:
			m += 1
		elif l[i] > l[i + 1]:
			if l[i] - l[i + 1] <= d:
				m += 1
			elif x == 1:
				x = 0
				m += 1
			else:
				break
		else:
			break
	print(m + 1)


for j in range(int(input())):
	(n, u, d) = map(int, input().split())
	h = list(map(int, input().split()))
	cnt = 1
	para = 1
	for i in range(n - 1):
		if h[i + 1] > h[i]:
			if h[i + 1] - h[i] <= u:
				cnt += 1
			else:
				break
		elif h[i + 1] < h[i]:
			if h[i] - h[i + 1] <= d:
				cnt += 1
			elif h[i] - h[i + 1] > d:
				if para == 1:
					cnt += 1
					para -= 1
				else:
					break
		else:
			cnt += 1
	print(cnt)


T = int(input())
for i in range(T):
	(N, U, D) = map(int, input().split())
	l = list(map(int, input().split()))
	c = 1
	p = 0
	for i in range(N - 1):
		if l[i] < l[i + 1]:
			if l[i + 1] - l[i] <= U:
				c += 1
			else:
				break
		elif l[i] > l[i + 1]:
			if l[i] - l[i + 1] <= D:
				c += 1
			elif p == 0:
				c += 1
				p = 1
			else:
				break
		else:
			c += 1
	print(c)


t = int(input())
for _ in range(t):
	(n, u, d) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	c = 1
	j = 1
	for i in range(n - 1):
		if a[i] >= a[i + 1]:
			if abs(a[i] - a[i + 1]) <= d:
				c += 1
			elif j == 1:
				c += 1
				j = 0
			else:
				break
		elif a[i] < a[i + 1]:
			if abs(a[i] - a[i + 1]) <= u:
				c += 1
			else:
				break
	print(c)


for i in range(int(input())):
	(n, u, d) = map(int, input().split())
	l = list(map(int, input().split()))
	c = 0
	h = 0
	for i in range(n - 1):
		a = abs(l[i] - l[i + 1])
		if l[i] == l[i + 1]:
			c = c + 1
		elif l[i] < l[i + 1] and a <= u:
			c = c + 1
		elif l[i] < l[i + 1] and a > u:
			break
		elif l[i] > l[i + 1] and a <= d:
			c = c + 1
		elif l[i] > l[i + 1] and a > d:
			h = h + 1
			if h <= 1:
				c = c + 1
			else:
				break
	print(c + 1)


for _ in range(int(input())):
	a = input().split()
	n = int(a[0])
	u = int(a[1])
	d = int(a[2])
	h = list(map(int, input().split()))
	parachute = True
	curr = 1
	for i in range(n - 1):
		if h[i + 1] > h[i]:
			if h[i + 1] > h[i] + u:
				break
		elif h[i + 1] < h[i]:
			if h[i + 1] < h[i] - d:
				if parachute:
					parachute = False
				else:
					break
		curr += 1
	print(curr)


for tc in range(int(input())):
	(n, u, d) = map(int, input().split())
	h = []
	h = list(map(int, input().split()))
	count = 1
	temp = 1
	for i in range(0, n - 1):
		if h[i + 1] - h[i] > u:
			break
		if h[i] - h[i + 1] > d:
			if temp > 0:
				count = count + 1
				temp = temp - 1
			else:
				break
		else:
			count = count + 1
	print(count)


t = int(input())
for i in range(t):
	(n, u, d) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	flag = True
	final = 0
	for i in range(n - 1):
		if a[i + 1] > a[i] + u:
			break
		elif a[i + 1] < a[i] - d:
			if flag:
				flag = False
			else:
				break
		final = i + 1
	print(final + 1)


t = int(input())
for t in range(0, t):
	q = list(map(int, input().rstrip().split()))
	n = q[0]
	u = q[1]
	d = q[2]
	e = 0
	c = 1
	a = list(map(int, input().rstrip().split()))
	for i in range(0, n - 1):
		if a[i + 1] > a[i]:
			if a[i + 1] - a[i] <= u:
				c = c + 1
			else:
				break
		elif a[i + 1] == a[i]:
			c = c + 1
		elif a[i] - a[i + 1] <= d:
			c = c + 1
		elif a[i] - a[i + 1] > d and e == 0:
			c = c + 1
			e = 1
		else:
			break
	print(c)


TC = int(input())
for tc in range(TC):
	(n, u, d) = map(int, input().split())
	a = list(map(int, input().split()))
	(ok, ans) = (True, 1)
	for i in range(1, n):
		if a[i] > a[i - 1] + u:
			break
		elif a[i] < a[i - 1] - d:
			if ok:
				ok = False
			else:
				break
		ans += 1
	print(ans)


for i in range(int(input())):
	(n, u, d) = map(int, input().split())
	l = list(map(int, input().split()))
	count = 0
	p = 0
	for i in range(n - 1):
		if l[i] < l[i + 1]:
			if l[i + 1] - l[i] <= u:
				count += 1
			else:
				break
		elif l[i] - l[i + 1] <= d:
			count += 1
		elif l[i] - l[i + 1] > d and p != 1:
			count += 1
			p = 1
		else:
			break
	print(count + 1)


for _ in range(int(input())):
	(n, u, d) = map(int, input().split())
	arr = tuple(map(int, input().split()))
	flag = 1
	for i in range(n - 1):
		if arr[i + 1] >= arr[i]:
			if arr[i + 1] - arr[i] > u:
				print(i + 1)
				break
		elif arr[i] - arr[i + 1] <= d:
			continue
		elif flag:
			flag = 0
		else:
			print(i + 1)
			break
	else:
		print(n)


t = int(input())
for i in range(t):
	parachute = 1
	crossed = 0
	(n, u, d) = [int(x) for x in input().split(' ')]
	hills = [int(h) for h in input().split(' ')]
	h = 0
	while h < n - 1:
		if hills[h] < hills[h + 1]:
			if hills[h + 1] - hills[h] > u:
				break
		elif hills[h] > hills[h + 1]:
			if hills[h] - hills[h + 1] > d:
				if parachute > 0:
					parachute -= 1
				else:
					break
		h += 1
	print(h + 1)


for _ in range(int(input())):
	(n, u, d) = map(int, input().split())
	hills = list(map(int, input().split()))
	parachute = 0
	end = 0
	for i in range(n - 1):
		if hills[i + 1] >= hills[i] and hills[i + 1] - hills[i] <= u:
			end += 1
		elif hills[i + 1] <= hills[i] and hills[i] - hills[i + 1] <= d:
			end += 1
		elif hills[i] - hills[i + 1] > d and parachute == 0:
			end += 1
			parachute = 1
		else:
			print(end + 1)
			break
	else:
		print(end + 1)


for _ in range(int(input())):
	(N, U, D) = list(map(int, input().split()))
	H = list(map(int, input().split()))
	jumps = 0
	paracount = 0
	for i in range(len(H) - 1):
		if H[i + 1] - H[i] <= U and H[i + 1] >= H[i]:
			jumps += 1
		elif H[i] >= H[i + 1] and H[i] - H[i + 1] <= D:
			jumps += 1
		elif H[i] - H[i + 1] > D and paracount == 0:
			jumps += 1
			paracount = 1
		else:
			break
	print(jumps + 1)


for i in range(int(input())):
	(n, u, d) = map(int, input().split())
	h = list(map(int, input().split()))
	c = 1
	p = 0
	for i in range(len(h) - 1):
		if h[i] == h[i + 1]:
			c += 1
		if h[i] < h[i + 1] and h[i + 1] - h[i] <= u:
			c += 1
		elif h[i] < h[i + 1] and h[i + 1] - h[i] > u:
			break
		if h[i] > h[i + 1] and h[i] - h[i + 1] <= d:
			c += 1
		elif h[i] > h[i + 1] and h[i] - h[i + 1] > d:
			if p == 0:
				c += 1
				p += 1
			else:
				break
	print(c)


t = int(input())
i = 0
j = 0
while i < t:
	(n, u, d) = map(int, input().split())
	l = list(map(int, input().split()))
	crt = 0
	para = 1
	for j in range(n - 1):
		if l[j] == l[j + 1]:
			crt += 1
			continue
		elif l[j] < l[j + 1]:
			if l[j + 1] - l[j] <= u:
				crt += 1
				continue
			else:
				break
		elif l[j] > l[j + 1]:
			if l[j] - l[j + 1] <= d:
				crt += 1
				continue
			elif para == 1:
				crt += 1
				para = 0
				continue
			else:
				break
		else:
			break
	print(crt + 1)
	i += 1


T = int(input())
for i in range(T):
	(N, U, D) = map(int, input().split())
	H = list(map(int, input().split()))
	hill_num = 0
	parachute = 1
	for i in range(N - 1):
		if H[i] == H[i + 1]:
			hill_num += 1
			continue
		elif H[i] < H[i + 1]:
			if H[i + 1] - H[i] <= U:
				hill_num += 1
				continue
			else:
				break
		elif H[i] > H[i + 1]:
			if H[i] - H[i + 1] <= D:
				hill_num += 1
				continue
			elif parachute == 1:
				hill_num += 1
				parachute = 0
				continue
			else:
				break
		else:
			break
	print(hill_num + 1)


for h in range(int(input())):
	(n, u, d) = map(int, input().split())
	l = list(map(int, input().split()))
	c = 1
	x = l[0]
	f = 0
	for i in range(1, n):
		if l[i] >= x:
			if l[i] - x <= u:
				x = l[i]
				c += 1
			else:
				break
		elif x - l[i] <= d:
			x = l[i]
			c += 1
		elif f == 0:
			x = l[i]
			c += 1
			f = 1
		else:
			break
	print(c)


t = int(input())
for i in range(t):
	(N, U, D) = map(int, input().split())
	Ar = list(map(int, input().split()))
	j = 1
	p = 1
	for i in range(N - 1):
		if Ar[i + 1] >= Ar[i] and abs(Ar[i + 1] - Ar[i]) <= U:
			j += 1
			continue
		elif Ar[i + 1] <= Ar[i] and abs(Ar[i + 1] - Ar[i]) <= D:
			j += 1
			continue
		elif Ar[i + 1] <= Ar[i] and p == 1:
			j += 1
			p = 0
			continue
		else:
			break
	print(j)


t = int(input())
for _ in range(t):
	(n, u, d) = [int(v) for v in input().split()]
	h = [int(v) for v in input().split()]
	para = True
	c = 0
	prev = 0
	for (i, v) in enumerate(h):
		if i == 0:
			prev = v
			continue
		if v > prev and v - prev > u:
			break
		if v < prev and prev - v > d:
			if not para:
				break
			para = False
		prev = v
		c = i
	print(c + 1)


t = int(input())
answer = []
for j in range(t):
	(n, u, d) = list(map(int, input().split()))
	inp = list(map(int, input().split()))
	steps = 0
	current = inp[0]
	inp = inp[1:]
	parachute = 0
	for i in range(len(inp)):
		if current == inp[i]:
			current = inp[i]
			steps += 1
			continue
		if inp[i] - current > 0:
			if inp[i] - current <= u:
				current = inp[i]
				steps += 1
			else:
				break
		else:
			if abs(inp[i] - current) <= d:
				current = inp[i]
				steps += 1
			if abs(inp[i] - current) > d:
				if parachute == 0:
					current = inp[i]
					steps += 1
					parachute += 1
				else:
					break
	answer.append(steps)
for i in answer:
	print(i + 1)


t = int(input())
for i in range(t):
	(n, u, d) = list(map(int, input().split()))
	h = list(map(int, input().split()))
	flag = 0
	flag1 = 0
	c = 0
	for i in range(n - 1):
		if h[i + 1] > h[i] and h[i + 1] - h[i] <= u:
			pass
		elif h[i + 1] > h[i] and h[i + 1] - h[i] > u:
			c = i
			break
		elif h[i + 1] < h[i]:
			if h[i] - h[i + 1] > d:
				if flag == 0:
					flag = 1
					pass
				else:
					c = i
					break
			elif h[i] - h[i + 1] <= d:
				pass
		if i == n - 2:
			flag1 = 1
			break
	if flag1 == 0:
		print(c + 1)
	elif flag1 == 1:
		print(n)


t = int(input())
for j in range(t):
	(n, u, d) = map(int, input().split())
	x = list(map(int, input().split()))
	c = 0
	p = -1
	for i in range(n - 1):
		if x[i] < x[i + 1]:
			if x[i + 1] - x[i] <= u:
				c += 1
			else:
				break
		elif x[i] == x[i + 1]:
			c += 1
		elif x[i] > x[i + 1]:
			if x[i] - x[i + 1] <= d:
				c = c + 1
			elif p == -1:
				c = c + 1
				p = 1
			else:
				break
	print(c + 1)


t = int(input())
for i in range(t):
	(n, u, d) = map(int, input().split())
	lst = list(map(int, input().split()))
	flag = True
	sum1 = 0
	for i in range(n - 1):
		if lst[i] <= lst[i + 1] and lst[i + 1] - lst[i] <= u:
			sum1 += 1
		elif lst[i] >= lst[i + 1]:
			if lst[i] - lst[i + 1] <= d:
				sum1 += 1
			elif flag == False:
				break
			else:
				sum1 += 1
				flag = False
		else:
			break
	print(sum1 + 1)


t = int(input())
for tc in range(t):
	(n, u, d) = map(int, input().split())
	a = list(map(int, input().split()))
	c = 0
	x = 1
	for j in range(0, n - 1):
		if a[j] >= a[j + 1] and a[j] - a[j + 1] <= d:
			c += 1
		elif a[j] <= a[j + 1] and a[j + 1] - a[j] <= u:
			c += 1
		elif a[j] - a[j + 1] > d and x == 1:
			c += 1
			x -= 1
		else:
			break
	print(c + 1)


import sys

def main():
	tc = int(input().strip())
	for _ in range(tc):
		(n, u, d) = map(int, input().strip().split())
		h = list(map(int, input().strip().split()))
		parcht = 1
		stopindex = 0
		cnt = 0
		for i in range(n - 1):
			if h[i] < h[i + 1]:
				if h[i + 1] - h[i] <= u:
					stopindex = i + 1
					continue
				else:
					break
			elif h[i + 1] < h[i]:
				if h[i] - h[i + 1] <= d:
					stopindex = i + 1
					continue
				elif parcht == 1:
					stopindex = i + 1
					parcht = 0
					continue
				else:
					break
			elif h[i] == h[i + 1]:
				cnt += 1
				stopindex = i + 1
		if cnt == n - 1:
			print(n)
		else:
			print(stopindex + 1)
main()


t = int(input())
for _ in range(t):
	(n, u, d) = map(int, input().split())
	h = list(map(int, input().split()))
	j = 1
	p = 1
	for i in range(1, n):
		if -d <= h[i] - h[i - 1] <= u:
			j += 1
		elif p and h[i] < h[i - 1]:
			p = 0
			j += 1
		else:
			break
	print(j)


t = int(input())
while t > 0:
	count = 0
	arr = []
	flag = 0
	(n, u, d) = [int(p) for p in input().split()]
	arr = list(map(int, input().strip().split()))
	for i in range(1, n):
		if arr[i] == arr[i - 1]:
			count += 1
		elif arr[i] <= arr[i - 1] + u and arr[i] > arr[i - 1]:
			count += 1
		elif arr[i] >= arr[i - 1] - d and arr[i] < arr[i - 1]:
			count += 1
		elif arr[i] < arr[i - 1] and flag == 0:
			count += 1
			flag = 1
		else:
			break
	print(count + 1)
	t -= 1


num = int(input())
for i in range(num):
	ldet = list(map(int, input().rstrip().split()))
	ldata = list(map(int, input().rstrip().split()))
	p = 0
	c = 1
	tr = True
	while p < len(ldata) - 1:
		subb = abs(ldata[p + 1] - ldata[p])
		if ldata[p] < ldata[p + 1] and subb <= ldet[1]:
			c = c + 1
		elif ldata[p] > ldata[p + 1] and subb <= ldet[2]:
			c = c + 1
		elif ldata[p] == ldata[p + 1]:
			c = c + 1
		elif ldata[p] > ldata[p + 1] and subb > ldet[2]:
			if tr:
				c = c + 1
				tr = False
			else:
				break
		else:
			break
		p = p + 1
	print(c)


for _ in range(int(input())):
	(hills, taller, lower) = map(int, input().split())
	heights = list(map(int, input().split()))
	reached = 1
	parachutes = 1
	stuck = False
	for index in range(hills):
		if index != hills - 1 and stuck == False:
			difference = heights[index] - heights[index + 1]
			if difference < 0:
				difference = abs(difference)
			if heights[index] <= heights[index + 1] and difference <= taller:
				reached += 1
			elif heights[index] >= heights[index + 1] and difference <= lower:
				reached += 1
			elif heights[index] > heights[index + 1] and parachutes >= 1:
				reached += 1
				parachutes = 0
			else:
				stuck = True
	print(reached)


for _ in range(int(input())):
	(n, u, d) = list(map(int, input().split()))
	hills = list(map(int, input().split()))
	u *= -1
	curr = hills[0]
	count = 0
	para = True
	for h in hills[1:]:
		if u <= curr - h <= d:
			count += 1
		elif para and curr - h > 1:
			count += 1
			para = False
		else:
			break
		curr = h
	print(count + 1)


for _ in range(int(input())):
	(n, u, d) = map(int, input().split())
	lst = list(map(int, input().split()))
	c = 0
	flag = 0
	count = 0
	for i in range(n - 1):
		if lst[i] == lst[i + 1]:
			count += 1
			c = i + 1
		elif lst[i] < lst[i + 1]:
			if lst[i + 1] - lst[i] <= u:
				c = i + 1
			else:
				break
		elif lst[i] > lst[i + 1]:
			if lst[i] - lst[i + 1] <= d:
				c = i + 1
			elif flag == 0:
				c = i + 1
				flag = 1
			else:
				break
		else:
			break
	if count == n - 1:
		print(n)
	else:
		print(c + 1)


for _ in range(int(input())):
	(n, u, d) = map(int, input().split())
	h = list(map(int, input().split()))
	count = 1
	parasuit = True
	for i in range(1, n):
		if h[i - 1] == h[i]:
			count += 1
		elif h[i - 1] - h[i] < 0 and abs(h[i - 1] - h[i]) <= u:
			count += 1
		elif h[i - 1] - h[i] > 0 and h[i - 1] - h[i] <= d:
			count += 1
		elif h[i - 1] - h[i] > 0 and h[i - 1] - h[i] > d and parasuit:
			count += 1
			parasuit = False
		else:
			break
	print(count)


t = int(input())
for i in range(t):
	(n, u, d) = map(int, input().split())
	l = list(map(int, input().split()))
	ind = 0
	c = 0
	for j in range(n - 1):
		if l[j] < l[j + 1]:
			ans = l[j + 1] - l[j]
			if ans <= u:
				ind = j + 1
			else:
				break
		elif l[j] > l[j + 1]:
			ans = l[j] - l[j + 1]
			if ans <= d:
				ind = j + 1
			elif c == 1:
				break
			else:
				ind = j + 1
				c = c + 1
		elif l[j] == l[j + 1]:
			ind = j + 1
			continue
	print(ind + 1)


for _ in range(int(input())):
	(n, u, d) = map(int, input().split())
	h = list(map(int, input().split()))
	b = 0
	for i in range(n):
		if i == n - 1:
			break
		if h[i + 1] > h[i]:
			if h[i + 1] - h[i] > u:
				break
		elif h[i + 1] < h[i]:
			if h[i] - h[i + 1] > d:
				if b == 0:
					b = 1
				else:
					break
	print(i + 1)


for t in range(int(input())):
	(n, u, d) = map(int, input().split())
	h = list(map(int, input().split()))
	flag = True
	count = 1
	for i in range(1, n):
		if -d <= h[i] - h[i - 1] <= u:
			count += 1
		elif h[i] < h[i - 1] and flag:
			flag = False
			count += 1
		else:
			break
	print(count)


t = int(input())
for _ in range(t):
	(n, u, d) = map(int, input().split())
	a = list(map(int, input().split()))
	par = 1
	result = 1
	for i in range(1, n):
		if a[i] > a[i - 1]:
			if a[i - 1] + u >= a[i]:
				result = i + 1
			else:
				break
		elif a[i] == a[i - 1]:
			result = i + 1
		elif a[i - 1] - d <= a[i]:
			result = i + 1
		elif par == 1:
			par = -1
			result = i + 1
		else:
			break
	print(result)


n = int(input())
for _ in range(n):
	(a, b, c) = map(int, input().split())
	lis = list(map(int, input().split()))
	flag = False
	ind = 0
	for i in range(len(lis) - 1):
		if lis[i] < lis[i + 1]:
			if lis[i + 1] - lis[i] <= b:
				pass
			else:
				break
		elif lis[i] > lis[i + 1]:
			if lis[i] - lis[i + 1] <= c:
				pass
			elif not flag:
				flag = True
			else:
				break
		ind += 1
	print(ind + 1)


t = int(input())
for i in range(t):
	(n, u, d) = map(int, input().split())
	n = list(map(int, input().split()))
	count = 1
	para = 1
	for i in range(1, len(n)):
		if -d <= n[i] - n[i - 1] <= u:
			count += 1
		elif para and n[i] < n[i - 1]:
			para -= 1
			count += 1
		else:
			break
	print(count)


for i in range(int(input())):
	(n, h, l) = map(int, input().split())
	a = list(map(int, input().split()))
	chance = 1
	c = 1
	for i in range(0, n - 1):
		if a[i + 1] >= a[i] and a[i + 1] - a[i] <= h:
			c += 1
			continue
		elif a[i + 1] < a[i] and a[i] - a[i + 1] <= l:
			c += 1
			continue
		elif chance == 1 and a[i + 1] < a[i]:
			c += 1
			chance = 0
			continue
		else:
			break
	print(c)


for _ in range(int(input())):
	(N, U, D) = map(int, input().split())
	L = list(map(int, input().split()))
	c = 0
	para = True
	while c < N - 1:
		if L[c] <= L[c + 1] and L[c + 1] - L[c] <= U:
			c += 1
		elif L[c] > L[c + 1] and L[c] - L[c + 1] <= D:
			c += 1
		elif L[c] > L[c + 1] and para:
			c += 1
			para = False
		else:
			break
	print(c + 1)


for x in range(int(input())):
	(N, U, D) = map(int, input().split())
	l = list(map(int, input().split()))
	p = 1
	count = 1
	if len(l) > 1:
		for x in range(N - 1):
			if l[x + 1] > l[x]:
				if l[x + 1] - l[x] <= U:
					count += 1
				else:
					break
			elif l[x] - l[x + 1] > D:
				if p != 0:
					count += 1
					p -= 1
				else:
					break
			else:
				count += 1
	print(count)


for _ in range(int(input())):
	(n, u, d) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	p = 0
	c = 0
	for i in range(1, n):
		if l[i] >= l[i - 1]:
			if l[i] - l[i - 1] <= u:
				c += 1
			else:
				break
		elif l[i - 1] - l[i] <= d:
			c += 1
		elif p == 0:
			c += 1
			p = 1
		else:
			break
	print(c + 1)


t = int(input())
for _ in range(t):
	(n, u, d) = map(int, input().split())
	h = list(map(int, input().split()))
	hc = 1
	flag = 0
	for i in range(n - 1):
		dif = h[i] - h[i + 1]
		if dif == 0:
			hc += 1
		elif dif < 0 and abs(dif) <= u:
			hc += 1
		elif dif > 0:
			if dif <= d:
				hc += 1
			elif flag == 0:
				hc += 1
				flag = 1
			else:
				break
		else:
			break
	print(hc)


for _ in range(int(input())):
	(N, U, D) = map(int, input().split())
	L = list(map(int, input().split()))
	count = 1
	parachute_used = 0
	if len(set(L)) == 1:
		print(len(L))
		continue
	for i in range(1, N):
		if L[i] - L[i - 1] == 0:
			count += 1
		elif L[i] > L[i - 1] and L[i] - L[i - 1] <= U:
			count += 1
		elif L[i] < L[i - 1] and (L[i - 1] - L[i] <= D or parachute_used == 0):
			count += 1
			if L[i - 1] - L[i] > D:
				parachute_used = 1
		else:
			break
	print(count)


for t in range(int(input())):
	(a, b, c) = map(int, input().split())
	l = [int(i) for i in input().split()]
	h = 1
	p = 1
	for i in range(a - 1):
		if l[i] > l[i + 1]:
			if abs(l[i] - l[i + 1]) <= c:
				h = h + 1
			elif p > 0:
				h = h + 1
				p = 0
			else:
				break
		elif l[i] <= l[i + 1]:
			if abs(l[i] - l[i + 1]) <= b:
				h = h + 1
			else:
				break
	print(h)


for _ in range(int(input())):
	(n, u, d) = map(int, input().split())
	heights = list(map(int, input().split()))
	hill = 1
	parachute = True
	for i in range(n - 1):
		this_hill = heights[i]
		next_hill = heights[i + 1]
		if this_hill + u < next_hill:
			break
		if next_hill + d < this_hill and parachute == False:
			break
		if this_hill + u >= next_hill:
			if next_hill + d >= this_hill or parachute:
				hill += 1
				if next_hill + d < this_hill:
					parachute = False
	print(hill)


for _ in range(int(input())):
	(n, u, d) = map(int, input().split(' '))
	li = list(map(int, input().split(' ')))
	(count, m) = (1, 0)
	for i in range(n - 1):
		diff = li[i + 1] - li[i]
		if diff == 0:
			count += 1
		elif diff > 0:
			if abs(diff) <= u:
				count += 1
			else:
				break
		elif diff < 0:
			if abs(diff) <= d:
				count += 1
			elif abs(diff) > d and m != 1:
				count += 1
				m = 1
			else:
				break
	print(count)