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.util.*;
  import java.io.*;
  
  public class Practice {
  	static boolean multipleTC = true;
  	FastReader in;
  	PrintWriter out;
  
  	static int mod = (int) (1e9 + 7);
  	int mod2 = 998244353;
  	int parent[];
  	int rank[];
  
  	public static void main(String[] args) throws Exception {
  		new Practice().run();
  	}
  
  	void run() throws Exception {
  		in = new FastReader();
  		out = new PrintWriter(System.out);
  		int T = (multipleTC) ? ni() : 1;
  		pre();
  		for (int t = 1; t <= T; t++)
  			solve(t);
  		out.flush();
  		out.close();
  	}
  
  	void pre() throws Exception {
  	}
  
  	void solve(int TC) throws Exception {
  		int n = ni();
  		long arr[] = readArr(n);
  		sort(arr);
  		long approx = arr[n - 1] / 3;
  		long min = Integer.MAX_VALUE;
  		for (long one = 0; one <= 3; one++) {
  			for (long two = 0; two <= 3; two++) {
  				for (long three = max(approx - 5, 0); three <= approx + 5; three++) {
  					long cur = minCoins(arr, one, two, three);
  					min = min(min, cur);
  				}
  
  			}
  		}
  		pn(min);
  
  	}
  
  	private long minCoins(long[] arr, long one, long two, long three) {
  		int n = arr.length;
  		for (int i = 0; i < n; i++) {
  			long need = arr[i];
  			boolean good = false;
  			outer: for (long x = 0; x <= one; x++) {
  				for (long y = 0; y <= two; y++) {
  					long req = need - x - (2 * y);
  					if (req >= 0 && req % 3 == 0 && req / 3 <= three) {
  						good = true;
  						break outer;
  					}
  				}
  			}
  			if (!good) {
  				return Integer.MAX_VALUE;
  			}
  		}
  		return one + two + three;
  	}
  
  	void union(int u, int v) {
  		u = findParent(u);
  		v = findParent(v);
  		if (rank[u] > rank[v]) {
  			parent[v] = u;
  		} else if (rank[u] < rank[v]) {
  			parent[u] = v;
  		} else {
  			parent[v] = u;
  			rank[u]++;
  		}
  	}
  
  	int findParent(int v) {
  		if (v == parent[v])
  			return v;
  		return parent[v] = findParent(parent[v]);
  	}
  
  	StringBuilder printArr(int arr[]) {
  		StringBuilder sb = new StringBuilder();
  		int n = arr.length;
  		for (int i = 0; i < n; i++) {
  			sb.append(arr[i] + " ");
  		}
  		return sb;
  	}
  
  	StringBuilder printArr(long arr[]) {
  		StringBuilder sb = new StringBuilder();
  		int n = arr.length;
  		for (int i = 0; i < n; i++) {
  			sb.append(arr[i] + " ");
  		}
  		return sb;
  	}
  
  	class pair {
  		int x, y;
  
  		pair(int x, int y) {
  			this.x = x;
  			this.y = y;
  		}
  
  		@Override
  		public String toString() {
  			return " " + x + ", " + y + "]";
  		}
  
  	}
  
  	class pairL {
  		long x, y;
  
  		pairL(long x, long y) {
  			this.x = x;
  			this.y = y;
  		}
  
  		@Override
  		public String toString() {
  			return " " + x + ", " + y + "]";
  		}
  
  	}
  
  	boolean isSorted(int arr[]) {
  		for (int i = 0; i < arr.length - 1; i++) {
  			if (arr[i] > arr[i + 1]) {
  				return false;
  			}
  		}
  		return true;
  	}
  
  	void swap(int arr[], int x, int y) {
  		int t = arr[x];
  		arr[x] = arr[y];
  		arr[y] = t;
  	}
  
  	static int bitCount(int x) {
  		return x == 0 ? 0 : (1 + bitCount(x & (x - 1)));
  	}
  
  	void sort(long arr[]) {
  		ArrayList<Long> list = new ArrayList<>();
  		for (int i = 0; i < arr.length; i++)
  			list.add(arr[i]);
  		Collections.sort(list);
  		for (int i = 0; i < arr.length; i++)
  			arr[i] = list.get(i);
  	}
  
  	static void dbg(Object... o) {
  		System.err.println(Arrays.deepToString(o));
  	}
  
  	ArrayList<Integer> primeFactorization(int n) {
  		ArrayList<Integer> factorization = new ArrayList<>();
  		while (n % 2 == 0) {
  			factorization.add(2);
  			n /= 2;
  		}
  		for (int d = 3; d * d <= n; d += 2) {
  			while (n % d == 0) {
  				factorization.add(d);
  				n /= d;
  			}
  		}
  		if (n > 1)
  			factorization.add(n);
  		return factorization;
  	}
  
  	private ArrayList<Integer> getPrimes(int n) {
  		boolean sieve[] = new boolean[n + 1];
  		sieve[0] = sieve[1] = true;
  		for (int i = 2; i * i <= n; i++) {
  			if (!sieve[i]) {
  				for (int j = i * i; j <= n; j += i) {
  					sieve[j] = true;
  				}
  			}
  		}
  		ArrayList<Integer> primes = new ArrayList<>();
  		for (int i = 2; i <= n; i++) {
  			if (!sieve[i]) {
  				primes.add(i);
  			}
  		}
  		return primes;
  	}
  
  	public static boolean isPrime(long n) {
  		if (n < 2)
  			return false;
  		if (n == 2 || n == 3)
  			return true;
  		if (n % 2 == 0 || n % 3 == 0)
  			return false;
  		long sqrtN = (long) Math.sqrt(n) + 1;
  		for (long i = 6L; i <= sqrtN; i += 6) {
  			if (n % (i - 1) == 0 || n % (i + 1) == 0)
  				return false;
  		}
  		return true;
  	}
  
  	public static long gcd(long a, long b) {
  		if (a > b)
  			a = (a + b) - (b = a);
  		if (a == 0L)
  			return b;
  		return gcd(b % a, a);
  	}
  
  	public long binaryExpo(long base, long exp) {
  		long res = 1;
  		while (exp > 0) {
  			if ((exp & 1) == 1)
  				res = res * base;
  			base = base * base;
  			exp >>= 1;
  		}
  		return res;
  	}
  
  	public long pow(long base, long exp, long MOD) {
  		base %= MOD;
  		long res = 1;
  		while (exp > 0) {
  			if ((exp & 1) == 1)
  				res = res * base % MOD;
  			base = base * base % MOD;
  			exp >>= 1;
  		}
  		return res;
  	}
  
  	public static long totient(long n) {
  		long result = n;
  		for (int p = 2; p * p <= n; ++p)
  			if (n % p == 0) {
  				while (n % p == 0)
  					n /= p;
  				result -= result / p;
  			}
  		if (n > 1)
  			result -= result / n;
  		return result;
  	}
  
  	int bit(long n) {
  		return (n == 0) ? 0 : (1 + bit(n & (n - 1)));
  	}
  
  	public long max(long... arr) {
  		long max = arr[0];
  		for (long itr : arr)
  			max = Math.max(max, itr);
  		return max;
  	}
  
  	public int max(int... arr) {
  		int max = arr[0];
  		for (int itr : arr)
  			max = Math.max(max, itr);
  		return max;
  	}
  
  	public long min(long... arr) {
  		long min = arr[0];
  		for (long itr : arr)
  			min = Math.min(min, itr);
  		return min;
  	}
  
  	public int min(int... arr) {
  		int min = arr[0];
  		for (int itr : arr)
  			min = Math.min(min, itr);
  		return min;
  	}
  
  	public long sum(long... arr) {
  		long sum = 0;
  		for (long itr : arr)
  			sum += itr;
  		return sum;
  	}
  
  	public long sum(int... arr) {
  		long sum = 0;
  		for (int itr : arr)
  			sum += itr;
  		return sum;
  	}
  
  	void p(Object o) {
  		out.print(o);
  	}
  
  	void pn(Object o) {
  		out.println(o);
  	}
  
  	void pni(Object o) {
  		out.println(o);
  		out.flush();
  	}
  
  	String n() throws Exception {
  		return in.next();
  	}
  
  	String nln() throws Exception {
  		return in.nextLine();
  	}
  
  	int ni() throws Exception {
  		return Integer.parseInt(in.next());
  	}
  
  	long nl() throws Exception {
  		return Long.parseLong(in.next());
  	}
  
  	long[] readArr(int n) throws Exception {
  		long arr[] = new long[n];
  		for (int i = 0; i < n; i++) {
  			arr[i] = nl();
  		}
  		return arr;
  	}
  
  	double nd() throws Exception {
  		return Double.parseDouble(in.next());
  	}
  
  	class FastReader {
  		BufferedReader br;
  		StringTokenizer st;
  
  		public FastReader() {
  			br = new BufferedReader(new InputStreamReader(System.in));
  		}
  
  		public FastReader(String s) throws Exception {
  			br = new BufferedReader(new FileReader(s));
  		}
  
  		String next() throws Exception {
  			while (st == null || !st.hasMoreElements()) {
  				try {
  					st = new StringTokenizer(br.readLine());
  				} catch (IOException e) {
  					throw new Exception(e.toString());
  				}
  			}
  			return st.nextToken();
  		}
  
  		String nextLine() throws Exception {
  			String str = "";
  			try {
  				str = br.readLine();
  			} catch (IOException e) {
  				throw new Exception(e.toString());
  			}
  			return str;
  		}
  	}
  }