Chef has a recipe book. He wishes to read it completely as soon as possible so that he could try to cook the dishes mentioned in the book.
The pages of the book are numbered $1$ through $N$. Over a series of days, Chef wants to read each page. On each day, Chef can choose to read any set of pages such that there is no prime that divides the numbers of two or more of these pages, i.e. the numbers of pages he reads on the same day must be pairwise coprime. For example, Chef can read pages $1$, $3$ and $10$ on one day, since $(1, 3)$, $(3, 10)$ and $(1, 10)$ are pairs of coprime integers; however, he cannot read pages $1$, $3$ and $6$ on one day, as $3$ and $6$ are both divisible by $3$. Since chef might get bored by reading the same recipe again and again, Chef will read every page exactly once.
Given $N$, determine the minimum number of days Chef needs to read the entire book and the pages Chef should read on each of these days.

-----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 and only line of each test case contains a single integer $N$.

-----Output-----
For each test case:
- First, print a line containing a single integer $D$ ― the minimum number of days required to read the book. Let's number these days $1$ through $D$.
- Then, print $D$ lines describing the pages Chef should read. For each valid $i$, the $i$-th of these lines should contain an integer $C_i$ followed by a space and $C_i$ space-separated integers ― the numbers of pages Chef should read on the $i$-th day.
If there are multiple solutions with the minimum number of days, you may print any one.

-----Constraints-----
- $1 \le T \le 10$
- $1 \le N \le 10^6$

-----Subtasks-----
Subtask #1 (20 points): $N \le 100$
Subtask #2 (80 points): original constraints

-----Example Input-----
1
5

-----Example Output-----
2
3 1 2 5
2 3 4

-----Explanation-----
Example case 1:
- On the first day, Chef should read three pages: $1$, $2$ and $5$.
- On the second day, Chef should read the remaining two pages: $3$ and $4$.
There are other valid solutions as well.

Difficulty: interview

Starter code:

Solutions:
def ugcd(n):
  ans = [[1]]
  if(n==1):
    return ans
  elif(n%2==1):
    ans = [[1, 2, n]]
  else:
    ans = [[1, 2]]
  for k in range(1, int(n//2)):
    ans.append([k*2+1, k*2+2])
  return ans
t = int(input())
for i in range(t):
  n = int(input())
  s = (ugcd(n))
  print(len(s))
  for j in range(len(s)):
    print(len(s[j]), end=" ")
    print(*s[j])

def ugcd(n):
  ans = [[1]]
  if(n==1):
    return ans
  elif(n%2==1):
    ans = [[1, 2, n]]
  else:
    ans = [[1, 2]]
  for k in range(1, int(n//2)):
    ans.append([k*2+1, k*2+2])
    
  return ans

test = int(input())
for i in range(test):
  n = int(input())
  p = (ugcd(n))
  print(len(p))
  for j in range(len(p)):
    print(len(p[j]), end=" ")
    print(*p[j])

try:
    for _ in range(int(input())):
        n = int(input())
        if n == 1:
            print(1)
            print(1, 1)
        elif n == 2:
            print(1)
            print(2, 1, 2)
        elif n == 3:
            print(1)
            print(3, 1, 2, 3)
        else:
            days = int(n / 2)
            if n % 2 == 0:
                print(days)
                for j in range(1, n + 1, 2):
                    print(2, j, j + 1)
            else:
                print(days)
                print(3, 1, 2, 3)
                for j in range(4, n + 1, 2):
                        print(2, j, j + 1)
except EOFError as e:
    print(end=" ")


from itertools import combinations

try:
    for _ in range(int(input())):
        def gcd(a, b):
            if a == 0 or b == 0: 
                return 0
            if a == b: 
                return a
            if a > b:
                return gcd(a - b, b)
            return gcd(a, b - a)


        def areNocoprime(arr):
            if gcd(arr[0], arr[1]) == 1:
                return True
            else:
                return False


        def iscoprime(arr):
            arr2 = list(combinations(arr, 2))
            arr3 = [areNocoprime(i) for i in arr2]
            if False in arr3:
                return False
            return True


        def isarraycoprime(arr, n):
            arr2 = []
            arr2.extend(arr)
            arr2.append(n)
            if iscoprime(arr2) is True:
                return arr2
            else:
                return arr
            
        sum = 0
        n = int(input())
        pages = [i for i in range(1, n + 1)]
        big_arr = []
        small_arr = []
        summ = 0
        while pages.count(0) != n:
            for i in range(0, n):
                if pages[i] != 0:
                    x = len(small_arr)
                    small_arr = isarraycoprime(small_arr, pages[i])
                    y = len(small_arr)
                    if x != y:
                        pages[i] = 0
            big_arr.append(small_arr)
            small_arr = []
        print(len(big_arr))
        for i in big_arr:
            print(len(i), *i)

except EOFError as e:
    print(end=" ")

from itertools import combinations

try:
    for _ in range(int(input())):
        def __gcd(a, b):
            if a == 0 or b == 0: return 0
            if a == b: return a
            if a > b:
                return __gcd(a - b, b)
            return __gcd(a, b - a)


        def areNocoprime(arr):
            if __gcd(arr[0], arr[1]) == 1:
                return True
            else:
                return False


        def iscoprime(arr):
            arr2 = list(combinations(arr, 2))
            arr3 = [areNocoprime(i) for i in arr2]
            if False in arr3:
                return False
            return True


        def isarraycoprime(arr, n):
            arr2 = []
            arr2.extend(arr)
            arr2.append(n)
            if iscoprime(arr2) is True:
                return arr2
            else:
                return arr
            
        sum = 0
        n = int(input())
        pages = [i for i in range(1, n + 1)]
        big_arr = []
        small_arr = []
        summ = 0
        while pages.count(0) != n:
            for i in range(0, n):
                if pages[i] != 0:
                    x = len(small_arr)
                    small_arr = isarraycoprime(small_arr, pages[i])
                    y = len(small_arr)
                    if x != y:
                        pages[i] = 0
            big_arr.append(small_arr)
            small_arr = []
        print(len(big_arr))
        for i in big_arr:
            print(len(i), *i)

except EOFError as e:
    print(end=" ")

# cook your dish here
test=int(input())
while test>0:
  n=int(input())
  if n==1:
    print(1)
    print(1,1)
  else:
    print(n//2)
    if n%2==0:
      i=1
      while i<=n:
        print(2,end=' ')
        print(i,end=' ')
        i+=1
        print(i,end=' ')
        i+=1
        print()
    else:
      i=1
      print(3,end=' ')
      print(i,end=' ')
      i+=1
      print(i,end=' ')
      i+=1
      print(i,end=' ')
      i+=1
      print()
      while i<=n:
        print(2,end=' ')
        print(i,end=' ')
        i+=1
        print(i,end=' ')
        i+=1
        print()
  test-=1


# cook your dish here
for _ in range(int(input())):
    N=int(input())
    seq=N//2
    if(N==1):
        print(1)
        print(1,1)
    elif(N==2):
        print(seq)
        print(2,1,2)
    elif(N%2!=0):
        print(seq)
        for i in range(1,N+1,2):
            if(i==1):
                print(3,1,i+1,i+2)
            elif(i>=4):
                print(2,i-1,i)
    else:
        print(seq)
        for i in range(1,N+1,2):
            if(i==1):
                print(2,1,i+1)
            elif(i>=3):
                print(2,i,i+1)

# cook your dish here
import math
t = int(input())
for _ in range(t):
    n = int(input())
    l = []
    if n<=3:
        print(1)
        print(1,n)
    else:
        l.append([3,1,2,3])
        for i in range(4,n,2):
            l.append([2,i,i+1])
        if n%2==0:
            l.append([1,n])
        print(len(l))
        for i in l:
            print(*i)
        


def gcd(a, b): 
    if (b == 0): 
         return a 
    return gcd(b, a%b)

testcase = int(input())
for tes in range(testcase) :
    n = int(input())
    arr = []
    for i in range(2, n+1, 2) :
        arr.append([i])
    leng = len(arr)
    for i in range(1, n+1, 2) :
        flag1 = False
        for j in range(leng) :
            flag2 = True
            for k in arr[j] :
                if gcd(i, k) != 1 and i!=1 and k!=1 :
                    flag2 = False
                    break
            if flag2 :
                arr[j].append(i)
                flag1 = True
                break
        if not flag1 :
            arr.append([i])
            leng += 1
    print(len(arr))
    for ele in arr :
        print(len(ele), end=' ')
        for i in ele :
            print(i, end=' ')
        print()

# cook your dish here
def gcd(a, b):
    while True :
        if (b == 0): 
            return a
        c = b
        b = a%b
        a = c
testcase = int(input())
for tes in range(testcase) :
    n = int(input())
    arr = []
    left = [i for i in range(3, n+1, 2)]
    for i in range(2, n+1, 2) :
        arr.append([i])
    leng = len(arr)
    if n > 1 :
        arr[0].append(1)
    if n == 1 :
        arr.append([1])
    num = 0
    np = 3
    while len(left) > 0 :
        if num == 0 or num > n :
            num = left[0]
            pnum = num
            i = 0
            p = np
            np += 2
        if num in left :
            left.remove(num)
            flag1 = False
            while i<len(arr) :
                flag2 = True
                for j in arr[i] :
                    if num%j==0 or ( j!=1 and gcd(num, j) != 1) :
                        flag2 = False
                        break
                if flag2 :
                    arr[i].append(num)
                    num = (p*pnum)
                    p += 2
                    flag1 = True
                    break
                i += 1
            if not flag1 :
                arr.append([i])
                num = (p*pnum)
                p += 2
        else :
            num = (p*pnum)
            p += 2
    print(len(arr))
    for ele in arr :
        print(len(ele), end=' ')
        for i in ele :
            print(i, end=' ')
        print()

# cook your dish here
import math

t = int(input())
for _ in range(t):
    n = int(input())
    a = []
    if n <= 3:
        print(1)
        print(n, end=" ")
        for i in range(1, n + 1):
            print(str(i), end=" ")
        print()
    else:
        print(math.ceil((n - 3) / 2) + 1)
        a = ["3 1 2 3"]
        for i in range(4, n, 2):
            a.append("2 " + str(i) + " " + str(i + 1))
        if (n & 1) == 0:
            a.append("1 "+str(n))
        print(*a, sep="\n")


# cook your dish here
for _ in range(int(input())):
    
    n=int(input())
    if n<=3:
        print(1)
        ans=[]
        for i in range(n):
            ans.append(i+1)
        print(n,*ans)
    
    else:
        print(n//2)
        if n%2==0:
            for i in range(1,n+1,2):
                print(2,i,i+1)
        else:
            print(3,1,2,3)
            for i in range(4,n+1,2):
                print(2,i,i+1)



# cook your dish here
for _ in range(int(input())):
    
    n=int(input())
    if n<=3:
        print(1)
        ans=[]
        for i in range(n):
            ans.append(i+1)
        print(n,*ans)
    
    else:
        print(n//2)
        if n%2==0:
            for i in range(1,n+1,2):
                print(2,i,i+1)
        else:
            print(3,1,2,3)
            for i in range(4,n+1,2):
                print(2,i,i+1)


t=int(input())
while(t>=1):
  t-=1
  a=int(input())
  if(a==1):
    print(1)
    print(*[1,1])
  else:
    print(a//2)
    for i in range(a//2-1):
      print(*[2,i*2+1,i*2+2])
    if(a%2==0):
      print(*[2,a-1,a])
    else:
      print(*[3,a-2,a-1,a])
 

import math
for _ in range(int(input())):
    x=int(input())
    if x==1:
        print("1")
        print("1"+' 1')
    elif x==2:
        print('1')
        print('2'+' 1'+' 2')
    elif x==3:
        print('1')
        print('3'+' 1'+' 2'+' 3')
    else:
        c=x//2
        if x%2==0:
            print(c)
            for i in range(1,x,2):
                print("2",end=' ')
                print(i,end=' ')
                print(i+1)
             
        else:
            print(c)
            print('3'+' 1'+' 2'+' 3')
            for i in range(4,x,2):
                print('2',end=' ')
                print(i,end=' ')
                print(i+1)
                
        
            

for _ in range(int(input())):
    n=int(input())
    if n%2==0:
        print(n//2)
        for i in range(1,n,2):
            print(2,i,i+1)
    else:
        if n==1:
            print(1)
            print(1,1)
        else:
            print(n//2)
            print(3,1,2,3)
            for i in range(4,n+1,2):
                print(2,i,i+1)
            


for _ in range(int(input())):
    n=int(input())
    if n%2==0:
        print(n//2)
        for i in range(1,n+1,2):
            print(2,i,i+1)
    else:
        if n==1:
            print(1)
            print(1,1)
        else:
            print(n//2)
            print(3,1,2,3)
            for i in range(4,n+1,2):
                print(2,i,i+1)
            


# cook your dish here
t=int(input())
while (t>0):
    t=t-1
    n=int(input())
    if n==1:
        print(1)
        print(1,1)
    else:
        print(n//2)
        if (n%2==0):
            for j in range(1,n,2):
                print(2,end=' ')
                print(j,j+1)
        else:
            print(3,1,2,3)
            j=4
            while(j<n):
                print(2,end=' ')
                print(j,j+1)
                j=j+2

# cook your dish here

for j in range(int(input())):
    n=int(input())
    if n==1:
        print(1)
        print(1,1)
    else:
        print(n//2)
        if (n%2==0):
            for j in range(1,n,2):
                print(2,end=' ')
                print(j,j+1)
        else:
            print(3,1,2,3)
            j=4
            while(j<n):
                print(2,end=' ')
                print(j,j+1)
                j=j+2

# cook your dish here
for _ in range(int(input())):
    n=int(input())
    if n%2==0:
        print(n//2)
        for i in range(1,n+1,2):
            print(2,i,i+1)
    else:
        if n==1:
            print(1)
            print(1,1)
        elif n>=3:
            print(n//2)
            print(3,1,2,3)
            for i in range(4,n+1,2):
                print(2,i,i+1)
        
        

try:
    t = int(input())
    for _ in range(t):
        n = int(input())
        l = []
        for y in range(1,n+1):
            l.append(y)
        if(n<4):
            print(1)
            print(n,end=" ")
            for i in range(1,n+1):
                print(i,end = " ")
            print()
        else:
            if(n%2==0):
                print(n//2)
                for i in range(1,n+1,2):
                    print(2,i,i+1)
            else:
                print(n//2)
                print(3,1,2,3)
                for i in range(4,n,2):
                    print(2,i,i+1)
except:
    pass

for _ in range(int(input())):
    n=int(input())
    if n==1:
        print(1)
        print(1,1)
        continue
    j=0
    if n%2==0:
        print(n//2)
        s=[[2,i,i+1] for i in range(1,n+1,2)]
        for i in s:
            print(*i)
    else:
        print(n//2)
        s=[[2,i,i+1] for i in range(4,n+1,2)]
        s.insert(0,[3,1,2,3])
        for i in s:
            print(*i)

t=int(input())
while(t>0):
    n=int(input())
    if(n==1):
        print(1)
        print(1,1)
    else:
        print(n//2)
        l=[]
        for i in range(1,n,2):
            l.append([i,i+1])
        if(n%2!=0):
            l[-1].append(n)
            for i in range(len(l)-1):
                print(2,*l[i])
            print(3,*(l[-1]))
        else:
            for i in l:
                print(2,*i)
    t-=1

t = int(input())
while(t):
    t-=1
    n = int(input())
    if n>1:
        print(n//2)
    else:
        print("1")
    if n<3:
        print(n,end = " ")
        for i in range(1,n+1):
            print(i,end = " ")
    if n==3:
        print("3",end = " ")
        print("1",end = " ")
        print("2",end = " ")
        print("3")
    if n>3:
        print("3",end = " ")
        print("1",end = " ")
        print("2",end = " ")
        print("3")
        for i in range(4,n,2):
            print("2",end = " ")
            print(i,end = ' ')
            print(i+1)
        if(n%2 == 0):
            print("1",end = " ")
            print(n)