You are given a sequence of integers $A_1, A_2, \ldots, A_N$. This sequence is circular ― for each valid $i$, the element $A_{i+1}$ follows after $A_i$, and the element $A_1$ follows after $A_N$.
You may insert any positive integers at any positions you choose in this sequence; let's denote the resulting sequence by $B$. This sequence is also circular. For each pair of its elements $B_s$ and $B_f$, let's denote the (non-circular) sequence created by starting at $B_s$ and moving from each element to the one that follows after it, until we reach $B_f$, by $B(s, f)$. This sequence includes the elements $B_s$ and $B_f$.
For each $K$ from $2$ to $N$ inclusive, find the smallest possible number of elements that need to be inserted into $A$ to form a sequence $B$ for which there is no subsequence $B(p, q)$ such that:
- The size of $B(p, q)$ is at least $K$.
- There is no pair of consecutive elements in $B(p, q)$ such that their GCD is equal to $1$.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains a single integer $N$.
- The second line contains $N$ space-separated integers $A_1, A_2, \ldots, A_N$.

-----Output-----
For each test case, print a single line containing $N-1$ space-separated integers. For each $i$ ($1 \le i \le N-1$), the $i$-th of these integers should be the smallest number of inserted elements in a valid sequence $B$ for $K = i+1$.

-----Constraints-----
- $1 \le T \le 2,000$
- $2 \le N \le 10^5$
- $1 \le A_i \le 10^9$ for each valid $i$
- the sum of $N$ over all test cases does not exceed $2 \cdot 10^6$

-----Example Input-----
1
5
3 6 4 5 9

-----Example Output-----
3 1 1 0

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '# cook your dish here\n# cook your dish here\n# cook your dish here\nimport math\ndef gcd(num1,num2):\n if(num2==0):\n  return num1\n else:\n  return gcd(num2,num1%num2)\n\n\nt=int(input())\nfor i in range(t):\n n=int(input())\n a=list(map(int,input().split()))\n l=[] #list with sublist starting and ending point of greater then 1 \xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0gcd\n sm=[]\n p1=0\n p2=0\n j=0\n while(j<n-1):\n  if(gcd(a[j],a[j+1])!=1):\n   p1=j+0\n   while(j<n-1 and gcd(a[j],a[j+1])!=1):\n    j+=1\n   p2=j+0\n   l.append([p1,p2])\n   sm.append(p2-p1+1)\n  else:\n   j+=1\n #last ka first aur age k kuch elements KA consider krna bch gya\n #agr last aur first ka gcd!=1 to dono merge honge\n if(len(l)>0 and l[0][1]-l[0][0]<n-1):\n  if(l[-1][1]==n-1 and l[0][0]==0):\n   if(gcd(a[-1],a[0])!=1):\n    #print(sm)\n    sm[0]+=sm[-1]\n    sm.pop()\n    #print(sm)\n  elif(gcd(a[-1],a[0])!=1 and l[0][0]==0):\n   sm[0]+=1\n  elif(gcd(a[-1],a[0])!=1 and l[-1][1]==n-1):\n   sm[-1]+=1\n  elif(gcd(a[-1],a[0])!=1):\n   sm.append(2)\n \n  w=[0]*(n+1)\n  for j in range(len(sm)):\n   for k in range(2,sm[j]+1):                #l[j][1]-l[j][0]+1 uska \xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0size h aur usko consider krne k liye +1 aur kiya h\n    w[k]+=math.ceil((sm[j]-1)//(k-1))\n  print(*w[2:])\n elif(len(l)>0):\n  w=[0]*(n+1)\n  if(gcd(a[-1],a[0])!=1):\n   for j in range(len(sm)):\n    for k in range(2,sm[j]+1):                #l[j][1]-l[j][0]+1 \xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0uska size h aur usko consider krne k liye +1 aur kiya h\n     w[k]+=math.ceil((sm[j]-1)//(k-1))+1\n   print(*w[2:])\n  else:\n   for j in range(len(sm)):\n    for k in range(2,sm[j]+1):                #l[j][1]-l[j][0]+1 \xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0uska size h aur usko consider krne k liye +1 aur kiya h\n     w[k]+=math.ceil((sm[j]-1)//(k-1))\n   print(*w[2:])\n else:\n  #print("No")\n  w=[0]*(n+1)\n  if(gcd(a[-1],a[0])!=1):\n   w[2]=1\n   print(*w[2:])\n  else:\n   print(*w[2:])'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 15143