import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static void canConstruct(int[] a) { // Return "Yes" or "No" denoting whether you can construct the required number. int[] arr=null;int i=0,j; for(j=0;j0) { arr[i]=(a[j])%10; i++; a[j]=a[j]/10; } printCombination(arr, arr.length-1, arr.length-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(); } canConstruct(a); //System.out.println(result); } in.close(); } static void combinationUtil(int arr[], int data[], int start, int end, int index, int r) { // Current combination is ready to be printed, print it if (index == r) { int[] a=null;int j; for ( j=0; j= r-index" makes sure that including one element // at index will make a combination with remaining elements // at remaining positions for (int i=start; i<=end && end-i+1 >= r-index; i++) { data[index] = arr[i]; combinationUtil(arr, data, i+1, end, index+1, r); } } // The main function that prints all combinations of size r // in arr[] of size n. This function mainly uses combinationUtil() static void printCombination(int arr[], int n, int r) { // A temporary array to store all combination one by one int data[]=new int[r]; // Print all combination using temprary array 'data[]' combinationUtil(arr, data, 0, n-1, 0, r); } }