for i in range(int(input())): a=int(input()) s=list(map(int,input().split())) count=0 for ipp in range(100000000000000): count+=a hako=sorted(list(str(count))) amount=[0]*9 for k in range(len(hako)): if hako[k]=="0": continue amount[int(hako[k])-1]+=1 check=0 for k in range(9): if amount[k]