description: One day, early in the morning, you decided to buy yourself a bag of chips in the nearby store. The store has chips of n different flavors. A bag of the i-th flavor costs a_i burles.
  
  The store may run out of some flavors, so you'll decide which one to buy after arriving there. But there are two major flaws in this plan: 
  
    1. you have only coins of 1, 2 and 3 burles; 
    2. since it's morning, the store will ask you to pay in exact change, i. e. if you choose the i-th flavor, you'll have to pay exactly a_i burles. 
  
  
  
  Coins are heavy, so you'd like to take the least possible number of coins in total. That's why you are wondering: what is the minimum total number of coins you should take with you, so you can buy a bag of chips of any flavor in exact change?
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases.
  
  The first line of each test case contains the single integer n (1 ≤ n ≤ 100) — the number of flavors in the store.
  
  The second line of each test case contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9) — the cost of one bag of each flavor.
  
  Output
  
  For each test case, print one integer — the minimum number of coins you need to buy one bag of any flavor you'll choose in exact change.
  
  Example
  
  Input
  
  
  4
  1
  1337
  3
  10 8 10
  5
  1 2 3 4 5
  3
  7 77 777
  
  
  Output
  
  
  446
  4
  3
  260
  
  Note
  
  In the first test case, you should, for example, take with you 445 coins of value 3 and 1 coin of value 2. So, 1337 = 445 ⋅ 3 + 1 ⋅ 2.
  
  In the second test case, you should, for example, take 2 coins of value 3 and 2 coins of value 2. So you can pay either exactly 8 = 2 ⋅ 3 + 1 ⋅ 2 or 10 = 2 ⋅ 3 + 2 ⋅ 2.
  
  In the third test case, it's enough to take 1 coin of value 3 and 2 coins of value 1.
solution: import java.io.BufferedReader;
  import java.io.BufferedWriter;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.OutputStreamWriter;
  import java.util.*;
  import java.util.stream.Stream;
  
  public class Program {
  
      static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
  
      public static void main(String[] args) throws NumberFormatException, IOException {
  
          int cases = Integer.parseInt(reader.readLine());
  //        int cases = 1;
          int mod = 998244353;
  
          while(cases-- > 0) {
  
              String[] firstLine = reader.readLine().split(" ");
  
              int n = Integer.parseInt(firstLine[0]);
              int[] arr = convertToIntPrimitiveArray();
  
              int total = Integer.MAX_VALUE;
  
              for(int j=0;j<=2;j++) {
                  for(int k=0;k<=2;k++) {
  
                      int coins = 0;
                      boolean poss = true;
                      int num = 0;
  
                      for(int l=0;l<arr.length;l++) {
                          int min = Integer.MAX_VALUE;
                          num = arr[l];
                          for(int a=0;a<=j;a++) {
                              for(int b=0;b<=k;b++) {
                                  int rem = arr[l] - 1*a -2*b;
                                  if(rem >= 0 && rem%3 == 0) {
                                      min = Math.min(min, rem/3);
                                  }
                              }
                          }
  
                          if(min != Integer.MAX_VALUE) {
                              coins = Math.max(coins, min);
                          }else {
                              poss = false;
                              break;
                          }
                      }
  
                      //System.out.println("isPoss for "+  num + " " + poss + " ones-" + j + " twos-" + k + " threes-" + coins);
  
                      if(!poss) {
                          continue;
                      }else {
                          total = Math.min(total, coins+j+k);
                      }
  
                  }
              }
  
              printNumber(total);
  
          }
  
          out.flush();
  
      }
  
       public static int ub(long[] arr, long num) {
          int start = 0;
          int end = arr.length;
          int mid = 0;
  
          while(start<end) {
              mid = start + (end-start)/2;
              if(arr[mid] < num) {
                  start = mid+1;
              }else {
                  end = mid;
              }
          }
          return start;
       }
  
      public static int[] convertToIntPrimitiveArray() throws IOException {
          String[] str = reader.readLine().split(" ");
          return Stream.of(str).mapToInt(Integer::parseInt).toArray();
      }
  
      public static Integer[] convertToIntArray(String[] str) {
          Integer[] arr = new Integer[str.length];
          for(int i=0;i<str.length;i++) {
              arr[i] = Integer.parseInt(str[i]);
          }
          return arr;
      }
  
      public static Long[] convertToLongArray(String[] str) {
          Long[] arr = new Long[str.length];
          for(int i=0;i<str.length;i++) {
              arr[i] = Long.parseLong(str[i]);
          }
          return arr;
      }
  
      public static long[] convertToLongPrimitiveArray() throws IOException {
          String[] str = reader.readLine().split(" ");
          return Stream.of(str).mapToLong(Long::parseLong).toArray();
      }
  
      public static void printYes() throws IOException {
          out.append("YES" + "\n");
      }
  
      public static void printNo() throws IOException {
          out.append("NO" + "\n");
      }
  
      public static void printNumber(long num) throws IOException {
          out.append(num + "\n");
      }
  
      public static long hcf(long a, long b) {
          if(b==0) return a;
          return hcf(b, a%b);
      }
  
      public static int findSet(int[] parent, int[] rank, int v) {
          if(v==parent[v]) {
              return v;
          }
          parent[v] = findSet(parent, rank, parent[v]);
          return parent[v];
      }
  
      public static void unionSet(int[] parent, int[] rank, int a, int b) {
  
          a = findSet(parent, rank, a);
          b = findSet(parent, rank, b);
  
          if(a == b) {
              return;
          }
  
          if(rank[a] < rank[b]) {
              int temp = a;
              a = b;
              b = temp;
          }
  
          parent[b] = a;
          if(rank[a] == rank[b]) {
              rank[a]++;
          }
  
      }
  
      public static void makeSet(int[] parent, int[] rank, int v) {
          parent[v] = v;
          rank[v] = 0;
      }
  
      public static long modularDivision(long a, long b, int mod) {
          if(a==0) return 1;
          a %= mod;
          long res = 1L;
          while(b > 0) {
              if((b&1)==1) {
                  res = (res * a)%mod;
              }
              a = (a*a)%mod;
              b >>= 1;
          }
          return res;
      }
  
      public static void customSort(int[] arr) {
          int n = arr.length;
          Random rnd = new Random();
          for(int i=0; i<n; ++i){
              int tmp = arr[i];
              int randomPos = i + rnd.nextInt(n-i);
              arr[i] = arr[randomPos];
              arr[randomPos] = tmp;
          }
          Arrays.sort(arr);
          return;
      }
  
      public static void customSortLong(long[] arr) {
          int n = arr.length;
          Random rnd = new Random();
          for(int i=0; i<n; ++i){
              long tmp = arr[i];
              int randomPos = i + rnd.nextInt(n-i);
              arr[i] = arr[randomPos];
              arr[randomPos] = tmp;
          }
          Arrays.sort(arr);
          return;
      }
  
      public static long[] factorial(int n, int mod) {
          long[] fact = new long[n+1];
          fact[0] = 1;
          for(int i=1;i<fact.length;i++) {
              fact[i] = (i*fact[i-1] + mod)%mod;
          }
          return fact;
      }
  
      public static long[] invfactorial(int n, int mod, long[] fact) {
          long[] invfact = new long[n+1];
          invfact[0] = 1L;
          for(int i=1;i<=n;i++) {
              invfact[i] = modularDivision(fact[i], mod-2, mod);
          }
          return invfact;
      }
  
      public static List<Integer> primeNumbers(int num) {
          boolean[] arr = new boolean[num+1];
          List<Integer> primes = new ArrayList<>();
  
          for(int i=2;i*i<=num;i++) {
              if(!arr[i]) {
                  for(int j=i;j*i<=num;j++) {
                      arr[j*i] = true;
                  }
              }
          }
  
          for(int i=2;i<=num;i++) {
              if(!arr[i]) {
                  primes.add(i);
              }
          }
          return primes;
      }
  
      public static long ncr(int n, int r, long mod, long[] fact, long[] invfact) {
          if(n<0 || r<0 || n < r) {
              return 0;
          }
          long temp = (fact[n]*invfact[n-r])%mod;
          temp = (temp*invfact[r])%mod;
          return temp;
      }
  
  
  }