for _ in range(int(input())):
X = int(input())
A = list(map(int, input().split()))
B = A[::-1]
if A == A[::-1]:
print('Yes')
else:
for i in range(X):
if abs((A[i]) - (B[i])) != 0 and abs((A[i]) - (B[i])) != 2:
print('No')
break
else:
print('Yes')
u are not accounting for if the midpoint is between all such pair of numbers with diff 2, if its not even with one such pair, its a no
I don’t understand, are you saying the difference cannot only be 2 or 0?