#1369 import sys;input = lambda: sys.stdin.readline().rstrip() #import heapq #from collections import deque #import numpy as np #from collections import Counter as cnt #from collections import defaultdict as ddc #from math import factorial as fct #from math import gcd #from bisect import bisect_left as bsl #from bisect import bisect_right as bsr #from itertools import accumulate as acc #from itertools import combinations as cmb #from itertools import permutations as pmt #from itertools import product as prd #from functools import reduce as red #import sys #sys.setrecursionlimit(10**9) #再帰を多く使う(デフォルトは1000) def kadomatsu(L): """kadomatsuならTrueを返す""" if len(set(L)) == 3 and L[1] in {min(L), max(L)}: return True return False for _ in range(int(input())): n = int(input()) A = list(map(int,input().split())) Sub = [A[i:i+3] for i in range(n-2)] Nk, ct, bct, B, b = [], 0, 0, [], 0 #bが0ならイエス、1ならノー for i, S in enumerate(Sub): if not kadomatsu(S): if Nk == []: ct += 1 bct = i B.append(i) else: if bct+2 < i: ct += 1 bct = i B.append(i) if ct > 2: b = 1 break Nk.append(i) if ct == 1: b0 = B[0] b = 1 flag = 0 for i in range(min(3, n-b0)): if not flag: for j in range(n): if A[b0+i] != A[j]: X = [a for a in A] X[b0+i], X[j] = X[j], X[b0+i] if all([kadomatsu(X[b0+i+k:b0+i+k+3]) for k in range(max(-2, -b0-i), min(3, n-3-b0-i))]): if all([kadomatsu(X[j+k:j+k+3]) for k in range(max(-2, -j), min(3, n-3-j))]): b = 0 flag = 1 break if ct == 2: b0, b1 = B b = 1 for i in range(min(3, n-b0)): for j in range(min(3, n-b1)): if A[b0+i] != A[b1+j]: X = [a for a in A] X[b0+i], X[b1+j] = X[b1+j], X[b0+i] if all([kadomatsu(X[b0+i+k:b0+i+k+3]) for k in range(max(-2, -b0-i), min(3, n-3-b0-i))]): if all([kadomatsu(X[b1+j+k:b1+j+k+3]) for k in range(max(-2, -b1-j), min(3, n-3-b1-j))]): b = 0 print('YNeos'[b::2], B)