import java.util.*;
class Node
{
int data;
Node next;
Node(int d)
{
data = d;
next = null;
}
}
class Is_LinkedList_Palindrom
{
Node head;
/* Function to print linked list */
void printList(Node head)
{
Node temp = head;
while (temp != null)
{
System.
out.
print(temp.
data+" "); temp = temp.next;
}
}
/* Inserts a new Node at front of the list. */
public void addToTheLast(Node node)
{
if (head == null)
{
head = node;
} else
{
Node temp = head;
while (temp.next != null)
temp = temp.next;
temp.next = node;
}
}
List<Integer> list = new ArrayList<>();
int ctr = 0;
boolean isPalindrome(Node head){
ctr = 0;
list.clear();
return isPalindromeUtil(head);
}
boolean isPalindromeUtil(Node head)
{
if(head==null) return true;
list.add(head.data);
isPalindromeUtil(head.next);
if(head.data == list.get(ctr++)) return true;
return false;
}
public static void main
(String args
[]) {
Scanner sc
= new Scanner
(System.
in); int t = sc.nextInt();
while(t>0)
{
int n = sc.nextInt();
//int k = sc.nextInt();
Is_LinkedList_Palindrom llist = new Is_LinkedList_Palindrom();
//int n=Integer.parseInt(br.readLine());
int a1=sc.nextInt();
Node head= new Node(a1);
llist.addToTheLast(head);
for (int i = 1; i < n; i++)
{
int a = sc.nextInt();
llist.addToTheLast(new Node(a));
}
//GfG g = new GfG();
//if(g.isPalindrome(llist.head) == true)
if(llist.isPalindrome(llist.head) == true)
else
t--;
}
}
}