import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static String canConstruct(int[] a) { int i; for(i=1;i<=a.length;i++){ int ab=combination(a,i); if(ab==1){ return "yes"; } } return "no"; // Return "Yes" or "No" denoting whether you can construct the required number. } public static int combination(int[] elements, int K){ // get the length of the array // e.g. for {'A','B','C','D'} => N = 4 int N = elements.length; if(K > N){ System.out.println("Invalid input, K > N"); return 0; } // calculate the possible combinations // e.g. c(4,2) c(N,K); // get the combination by index // e.g. 01 --> AB , 23 --> CD int combination[] = new int[K]; // position of current index // if (r = 1) r* // index ==> 0 | 1 | 2 // element ==> A | B | C int r = 0; int index = 0; while(r >= 0){ // possible indexes for 1st position "r=0" are "0,1,2" --> "A,B,C" // possible indexes for 2nd position "r=1" are "1,2,3" --> "B,C,D" // for r = 0 ==> index < (4+ (0 - 2)) = 2 if(index <= (N + (r - K))){ combination[r] = index; // if we are at the last position print and increase the index if(r == K-1){ //do something with the combination e.g. add to list or print int zq; for(zq=1;zq<=k;zq++){ if(combination[zq]/3==0){ return 1; } } // print(combination, elements); index++; } else{ // select index for next position index = combination[r]+1; r++; } } else{ r--; if(r > 0) index = combination[r]+1; else index = combination[0]+1; } } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int a0 = 0; a0 < t; a0++){ int n = in.nextInt(); int[] a = new int[n]; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextInt(); } String result = canConstruct(a); System.out.println(result); } in.close(); } }