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: # -----------------FAST IO-------------------------
  import os
  import sys
  from io import BytesIO, IOBase
  
  BUFSIZE = 8192
  
  
  class FastIO(IOBase):
      newlines = 0
  
      def __init__(self, file):
          self._fd = file.fileno()
          self.buffer = BytesIO()
          self.writable = "x" in file.mode or "r" not in file.mode
          self.write = self.buffer.write if self.writable else None
  
      def read(self):
          while True:
              b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
              if not b:
                  break
              ptr = self.buffer.tell()
              self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
          self.newlines = 0
          return self.buffer.read()
  
      def readline(self):
          while self.newlines == 0:
              b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
              self.newlines = b.count(b"\n") + (not b)
              ptr = self.buffer.tell()
              self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
          self.newlines -= 1
          return self.buffer.readline()
  
      def flush(self):
          if self.writable:
              os.write(self._fd, self.buffer.getvalue())
              self.buffer.truncate(0), self.buffer.seek(0)
  
  
  class IOWrapper(IOBase):
      def __init__(self, file):
          self.buffer = FastIO(file)
          self.flush = self.buffer.flush
          self.writable = self.buffer.writable
          self.write = lambda s: self.buffer.write(s.encode("ascii"))
          self.read = lambda: self.buffer.read().decode("ascii")
          self.readline = lambda: self.buffer.readline().decode("ascii")
  
  
  # sys.stdin = open('input.txt', 'r')
  # sys.stdout = open('output.txt', 'w')
  # sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
  # input = lambda: sys.stdin.readline().rstrip("\r\n")
  
  #---------------------------------------------------
  
  import math
  import collections
  from itertools import permutations
  from itertools import combinations
  
  
  '''def is_prime(n):
      j=2
      while j*j<=n:
          if n%j==0:
              return 0
          j+=1
      return 1'''
  
  
  '''def gcd(x, y):
      while(y):
          x, y = y, x % y
      return x'''
  
  '''fact=[]
  def factors(n) :
       
      i = 1
      while i <= math.sqrt(n):
           
          if (n % i == 0) :
               
              if (n / i == i) :
                  fact.append(i)
  
              else :
      
                  fact.append(i)
                  fact.append(n//i)
          i = i + 1'''
  # def LCMofArray(a):
  #   lcm = a[0]
  #   for i in range(1,len(a)):
  #     lcm = lcm*a[i]//math.gcd(lcm, a[i])
  #   return lcm
  def prob():
      
      n = int(input())
      # n,k=[int(x) for x in input().split()]
      # s = input()
      l = [int(x) for x in input().split()]
      # m = [x for x in input().split()]
      
      s = set(l)
      li = set(i%3 for i in s)
      mxx = max(s)
  
      if mxx == 1:
          print(1)
          return
  
      if mxx % 3 == 0:
          ans = mxx//3
  
          if 1 in li or 2 in li:
              ans+=1
  
          print(ans)
  
      elif mxx % 3 == 1:
          ans = mxx // 3
  
          c = 0
  
          if 1 in s or mxx-1 in s:
              c+=1
  
          if 2 in li:
              c+=1
  
          ans += max(c,1)
  
          print(ans)
  
      else:
          ans = mxx//3 + 1
  
          if 1 in li:
              ans+=1
  
          print(ans)
  
  
  # sys.stdin , sys.stdout = open('input.txt', 'r') , open('output.txt', 'w')
  sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
  input = lambda: sys.stdin.readline().rstrip("\r\n")
  
  t=1
  t=int(input())
  
  for _ in range(0,t):
      # print("Case #" , end="")
      # print(_+1 , end=": ")
      prob()