There are $n$ bags with candies, initially the $i$-th bag contains $i$ candies. You want all the bags to contain an equal amount of candies in the end.

To achieve this, you will:

Choose $m$ such that $1 \le m \le 1000$

Perform $m$ operations. In the $j$-th operation, you will pick one bag and add $j$ candies to all bags apart from the chosen one.

Your goal is to find a valid sequence of operations after which all the bags will contain an equal amount of candies.

It can be proved that for the given constraints such a sequence always exists.

You don't have to minimize $m$.

If there are several valid sequences, you can output any.


-----Input-----

Each test contains multiple test cases.

The first line contains the number of test cases $t$ ($1 \le t \le 100$). Description of the test cases follows.

The first and only line of each test case contains one integer $n$ ($2 \le n\le 100$).


-----Output-----

For each testcase, print two lines with your answer.

In the first line print $m$ ($1\le m \le 1000$) — the number of operations you want to take.

In the second line print $m$ positive integers $a_1, a_2, \dots, a_m$ ($1 \le a_i \le n$), where $a_j$ is the number of bag you chose on the $j$-th operation.


-----Examples-----

Input
2
2
3
Output
1
2
5
3 3 3 1 2


-----Note-----

In the first case, adding $1$ candy to all bags except of the second one leads to the arrangement with $[2, 2]$ candies.

In the second case, firstly you use first three operations to add $1+2+3=6$ candies in total to each bag except of the third one, which gives you $[7, 8, 3]$. Later, you add $4$ candies to second and third bag, so you have $[7, 12, 7]$, and $5$ candies to first and third bag  — and the result is $[12, 12, 12]$.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Constructive algorithms


Solutions:
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	t = int(input())
	print(t)
	for x in range(1, t + 1):
		print(x, end=' ')
	print()


import sys
import heapq
import copy
import math
import decimal
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def insr2():
	s = input()
	s = list(s[:len(s) - 1])
	s = [ord(s[i]) - ord('a') for i in range(len(s))]
	return s

def invr():
	return map(int, input().split())
ans = 0

def pr_list(a):
	print(*a, sep=' ')

def swap(a, b):
	temp = a
	a = b
	b = temp
	return [a, b]
mod = 1000000007

def pri(a, b):
	s = '? ' + str(a) + ' ' + str(b)
	print(s)
	sys.stdout.flush()

def solve():
	[n, m] = inlt()
	arr = inlt()
	return

def main():
	test = 1
	test = inp()
	for i in range(test):
		n = inp()
		print(n)
		arr = [i + 1 for i in range(n)]
		pr_list(arr)
main()


for t in range(int(input())):
	n = int(input())
	print(n)
	print(*list(range(1, n + 1)))


import sys
import math, bisect
sys.setrecursionlimit(10 ** 5)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict
I = lambda : int(sys.stdin.readline())
neo = lambda : map(int, sys.stdin.readline().split())
Neo = lambda : list(map(int, sys.stdin.readline().split()))
for _ in range(I()):
	n = I()
	print(n - 1)
	for i in range(n - 1):
		print(i + 2, end=' ')
	print()


for s in [*open(0)][1:]:
	n = int(s)
	print(n - 1, *range(2, n + 1))


for _ in range(int(input())):
	n = int(input())
	print(n)
	l = list(range(1, n + 1))
	print(*l)


def solve():
	n = int(input())
	if n == 2:
		print(1)
		print(2)
		return
	print(n)
	for i in range(1, n + 1):
		print(i, end=' ')
	print(end='\n')
for _ in range(int(input())):
	solve()


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def solve():
	a = int(input())
	print(a)
	lst = []
	for i in range(1, a + 1):
		lst.append(i)
	print(*lst)

def main():
	testcases = 1
	testcases = int(input())
	for _ in range(testcases):
		solve()
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	n = int(input())
	print(n)
	print(*range(1, n + 1))


import io, os
from math import *
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	n = int(input())
	print(n)
	print(*list(range(1, n + 1)))


ii = int(input())
for i in range(ii):
	m = int(input())
	print(m)
	for k in range(m):
		print(k + 1, end=' ')


import sys
for _ in range(int(sys.stdin.readline())):
	a = int(sys.stdin.readline())
	print(a)
	print(' '.join([str(i) for i in range(1, a + 1)]))


for _ in range(int(input())):
	n = int(input())
	print(n)
	for i in range(1, n + 1):
		print(i, end=' ')
	print()


for i in range(int(input())):
	x = int(input())
	print(x - 1)
	print(*list(range(2, x + 1)))


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		print(n)
		l = []
		for i in range(n):
			l.append(i + 1)
		print(*l)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


t = int(input())
for i in range(t):
	n = int(input())
	print(n)
	for i in range(n):
		print(i + 1, end=' ')
	print()


T = int(input())
for case in range(T):
	n = int(input())
	print(n)
	a = list(map(str, list(range(1, n + 1))))
	print(' '.join(a))


t = int(input())
for _ in range(t):
	n = int(input())
	print(n)
	print(' '.join([str(i + 1) for i in range(n)]))


t = int(input())
ll = []
for _ in range(t):
	ll.append(int(input()))
for l in ll:
	print(l)
	print(' '.join([str(i) for i in range(1, l + 1)]))


for __ in range(int(input())):
	n = int(input())
	ans = [i for i in range(1, n + 1)]
	print(len(ans))
	print(*ans)


a = int(input())
for i in range(a):
	b = int(input())
	arr = [str(i) for i in range(b, 1, -1)]
	arr = arr[::-1]
	print(len(arr))
	print(' '.join(arr))


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
			self.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, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]
MOD = 10 ** 9 + 7

def solve():
	N = getInt()
	ans = [j + 1 for j in range(N)]
	print(N)
	print(*ans)
	return
for _ in range(getInt()):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	print(n)
	l = [x for x in range(1, n + 1)]
	print(*l)


import sys
import collections
input = sys.stdin.readline
deque = collections.deque
for _ in range(int(input())):
	n = int(input())
	print(n)
	if n == 2:
		print(1)
		print(2)
	else:
		for i in range(n):
			print(i + 1, end=' ')
		print()


for i in range(int(input())):
	n = int(input())
	g = []
	for j in range(n):
		g.append(j + 1)
	print(n)
	print(' '.join(map(str, g)))


from cmath import *
from math import *
from decimal import *
from collections import *
import numbers
from operator import index
import sys

def _input():
	return map(int, input().split())

def _list():
	return list(map(int, input().split()))

def _int():
	return int(input())

def solves():
	n = int(input())
	print(n)
	for i in range(1, n + 1):
		print(i, end=' ')
	print()
t = 1
t = int(input())
for _ in range(0, t):
	solves()


for t in range(int(input())):
	n = int(input())
	if n == 2:
		print(1)
		print(2)
	else:
		print(n)
		for i in range(n):
			print(i + 1, end=' ')
		print()


n = int(input())
for i in range(n):
	m = int(input())
	print(m)
	print(*[k for k in range(1, m + 1)])


t = int(input())
answers = []
for _ in range(t):
	n = int(input())
	m = n - 1
	answer = []
	a = []
	answer.append(m)
	for k in range(2, n + 1):
		a.append(str(k))
	answer.append(a)
	answers.append(answer)
for j in range(t):
	print(answers[j][0])
	print(' '.join(answers[j][1]))


t = int(input())
for _ in range(t):
	n = int(input())
	print(n)
	l = [i + 1 for i in range(n)]
	print(*l)


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	print(n - 1)
	print(*[i + 1 for i in range(1, n)])


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	print(n)
	for i in range(n):
		print(i + 1, end=' ')


number_of_tests = int(input())
for Q in range(number_of_tests):
	n = int(input())
	print(n)
	for i in range(n):
		print(i + 1, end=' ')
	print()


import sys
import math
input = sys.stdin.readline
t = int(input())
for w in range(t):
	n = int(input())
	print(n)
	print(*[i for i in range(1, n + 1)])


for t in range(int(input())):
	n = int(input())
	pack = [i + 1 for i in range(n)]
	print(len(pack))
	print(*pack)


for s in [*open(0)][1:]:
	n = int(s)
	print(n)
	a = [i for i in range(1, n + 1)]
	print(*a[0:])


import sys, os.path
from collections import *
from heapq import *
from copy import *
import math
mod = 10 ** 9 + 7
read = lambda : map(int, input().split())
inf = float('inf')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for t in range(int(input())):
	n = int(input())
	a = [i + 1 for i in range(n)]
	print(n)
	print(*a)


t = int(input())
for i in range(0, t):
	n = int(input())
	print(n)
	a = ''
	for i in range(0, n):
		a += str(i + 1) + ' '
	print(a)


for k in range(int(input())):
	n = int(input())
	ans = [i + 1 for i in range(n)]
	print(n)
	print(*ans)


t = int(input())
while t > 0:
	n = int(input())
	print(n)
	for i in range(1, n + 1, 1):
		print(i, end=' ')
	print('')
	t -= 1


for j in range(int(input())):
	n = input()
	output = ''
	for i in range(int(n)):
		output += str(i + 1) + ' '
	print(n)
	print(output)


import math
t = int(input())
for _ in range(t):
	N = int(input())
	print(f'{N}')
	for n in range(1, N + 1):
		if n != N:
			print(f'{n}', end=' ')
		else:
			print(f'{n}', end='\n')


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def solve():
	n = int(input())
	print(n)
	print(*range(1, n + 1))
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for T in range(t):
	n = int(input())
	print(n)
	result = ''
	for i in range(1, n):
		result += str(i)
		result += ' '
	result += str(n)
	print(str(result))


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 2:
		print(1)
		print(2)
	else:
		print(n)
		l = [i for i in range(1, n + 1)]
		print(*l)


for i in range(int(input())):
	n = int(input().strip())
	print(n)
	print(*list(range(1, n + 1)))


import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	n = int(input())
	print(n)
	print(*list(range(1, n + 1)))


import os
import sys
from io import BytesIO, IOBase
import math
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, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input()) if True else 1):
	n = int(input())
	print(n)
	for i in range(1, n + 1):
		print(i, end=' ')
	print()


from collections import defaultdict as dd, deque as dq, Counter as c
from math import factorial as f, ceil, gcd, sqrt
from itertools import permutations as p

def it():
	return int(input())

def mp():
	return map(int, input().split())
for j in range(it()):
	a = it()
	print(a)
	for i in range(1, a + 1):
		print(i, end=' ')
	print()


import typing
import sys
import math
import collections
import bisect
import itertools
import heapq
import decimal
import copy
INF = 10 ** 20
MOD = 10 ** 9 + 7

def ni():
	return int(sys.stdin.buffer.readline())

def ns():
	return map(int, sys.stdin.buffer.readline().split())

def na():
	return list(map(int, sys.stdin.buffer.readline().split()))

def na1():
	return list(map(lambda x: int(x) - 1, sys.stdin.buffer.readline().split()))

def main():
	t = ni()
	for _ in range(t):
		n = ni()
		print(n - 1)
		ans = [i for i in range(2, n + 1)]
		print(*ans, sep=' ')
main()


for _ in range(int(input())):
	n = int(input())
	print(n)
	ll = [i for i in range(1, n + 1)]
	print(*ll)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
for _ in range(inp()):
	n = inp()
	print(n)
	print(*range(1, n + 1))


for i in ' ' * int(input()):
	n = int(input())
	r = str(n) + '\n'
	for i in range(1, n + 1):
		r += str(i) + ' '
	print(r)


n = int(input())
results = []
for i in range(n):
	m = int(input())
	results.append([i for i in range(1, m + 1)])
for result in results:
	print(len(result))
	for value in result:
		print(value, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	print(n)
	ans = [i for i in range(1, n + 1)]
	print(*ans)


import collections

def f():
	n = int(input())
	for i in range(n):
		a = [x + 1 for x in range(int(input()))]
		m = len(a)
		s = ''
		for x in a:
			s += '%d ' % x
		print(m)
		print(s.strip())
f()


for _ in range(int(input())):
	n = int(input())
	print(n)
	l = []
	for i in range(n):
		l.append(i + 1)
	print(*l)


test_cases = int(input())
for i in range(test_cases):
	bags = int(input())
	print(str(bags))
	print(' '.join([str(j) for j in range(1, bags + 1)]))


for case in range(int(input())):
	n = int(input())
	print(n)
	arr = [x for x in range(1, n + 1)]
	print(*arr)


for _ in range(int(input())):
	n = int(input())
	print(n)
	a = [i for i in range(1, n + 1)]
	print(*a)


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import random
import re
import sys
import time
import string
from typing import List, ValuesView
sys.setrecursionlimit(99999)
t = int(input())
for _ in range(t):
	n = int(input())
	print(n - 1)
	print(*list(range(2, n + 1)))


for _ in range(int(input())):
	n = int(input())
	ans = list(range(1, n + 1))
	print(n)
	print(*ans)


import sys
from collections import deque
from copy import *
from bisect import *
from math import gcd, ceil, sqrt
from itertools import permutations as prm, product

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]

def string(s):
	return ''.join(s)

def fori(n):
	return [fi() for i in range(n)]

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def bo(i):
	return ord(i) - ord('A')

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def gtc(tc, ans):
	print('Case #' + str(tc) + ':', ans)

def cil(n, m):
	return n // m + int(n % m > 0)

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j, n, m):
	return 0 <= i < n and 0 <= j < m

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
uu = t
while t > 0:
	t -= 1
	n = fi()
	print(n)
	print(*[i + 1 for i in range(n)])


t = int(input())
for i in range(t):
	n = int(input())
	print(n - 1)
	j = n
	for i in range(2, n + 1):
		print(i, end=' ')


import sys

def run(use_file_io):
	if use_file_io:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
		try:
			solve()
		finally:
			sys.stdin.close()
			sys.stdout.close()
	else:
		solve()

def getnums():
	return map(int, input().split())

def solve():
	tests = int(input())
	for i in range(tests):
		n = int(input())
		print(n)
		print(*range(1, n + 1))
run(False)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		n = int(input())
		ans = list(range(1, n + 1))
		yield n
		yield ' '.join([str(x) for x in ans])
t = int(input())
ans = gift()
print(*ans, sep='\n')


lst = []
for _ in range(int(input())):
	k = int(input())
	if k == 2:
		lst.append([1])
		lst.append([2])
		continue
	lst.append([k])
	lst.append([i for i in range(1, k + 1)])
for i in lst:
	print(*i)


t = int(input())
for _ in range(t):
	n = int(input())
	res = (i + 1 for i in range(n))
	print(n)
	print(*res)


import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	try:
		for _ in range(inp()):
			n = inp()
			print(n - 1)
			for i in range(2, n + 1):
				print(i, end=' ')
			print('')
	except Exception as e:
		print(e)
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, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for i in range(int(input())):
	n = int(input())
	print(n)
	print(*[i for i in range(1, n + 1)])


for _ in range(int(input())):
	n = int(input())
	m = n
	k = [j for j in range(1, m + 1)]
	print(m)
	print(*k)


def main():
	for _ in range(int(input())):
		n = int(input())
		m = n
		ans = [i for i in range(1, n + 1)]
		print(m)
		print(*ans)
main()


import sys
import os
import math
import copy
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations, accumulate

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def watch(x):
	return print(x)

def common(l1, l2):
	return set(l1).intersection(l2)

def Most_frequent(list):
	return max(set(list), key=list.count)

def solution():
	for _ in range(Int()):
		n = Int()
		print(n)
		for i in range(1, n + 1):
			print(i, end=' ')
		print()
solution()


import sys, math, itertools, collections, copy
input = sys.stdin.readline

def solve():
	N = int(input())
	print(N - 1)
	ans = list(range(2, N + 1))
	print(*ans)
for _ in range(int(input())):
	solve()


from sys import stdin, stdout
import math, bisect
from collections import Counter, deque, defaultdict
L = lambda : list(map(int, stdin.readline().strip().split()))
M = lambda : map(int, stdin.readline().strip().split())
I = lambda : int(stdin.readline().strip())
S = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()

def pr(a):
	print(' '.join(list(map(str, a))))

def solve():
	n = I()
	print(n)
	for i in range(n):
		print(i + 1, end=' ')
	print()
for _ in range(I()):
	solve()


import math
from collections import Counter, defaultdict, deque

def f(n):
	m = n
	a = [i + 1 for i in range(n)]
	a.insert(0, m)
	return a
t = int(input())
result = []
for i in range(t):
	n = int(input())
	result.append(f(n))
for i in range(t):
	print(result[i][0])
	for j in range(1, len(result[i])):
		print(result[i][j], end=' ')
	print()


import math
import collections
import bisect

def arrPrint(a):
	return ' '.join([str(i) for i in a])

def gridPrint(a):
	return '\n'.join([' '.join([str(j) for j in a[i]]) for i in range(len(a))])

def isPalindrome(s):
	for i in range(len(s) // 2):
		if not s[i] == s[-i - 1]:
			return False
	return True

def primeCheck(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def solve(n):
	ans = [i + 1 for i in range(n)]
	print(n)
	return arrPrint(ans)
t = int(input())
for _ in range(t):
	n = int(input())
	print(solve(n))


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
from itertools import permutations, combinations

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1000000000.0) + 7
for t in range(int(data())):
	n = int(data())
	out(n)
	outl(list(range(1, n + 1)))


for T in range(int(input())):
	n = int(input())
	print(n - 1)
	a = [i for i in range(2, n + 1)]
	print(*a)


import sys
input0 = sys.stdin.readline
t = int(input0())
for _ in range(t):
	n = int(input0())
	do = [i for i in range(2, n + 1)]
	print(n - 1)
	print(*do)


import collections
import math
import collections
import sys
from functools import reduce
import decimal
sys.setrecursionlimit(10 ** 9)
decimal.getcontext().rounding = decimal.ROUND_HALF_UP
graphDict = collections.defaultdict
queue = collections.deque()

class Graphs:

	def __init__(self):
		self.graph = graphDict(list)

	def add_edge(self, u, v):
		self.graph[u].append(v)

	def dfs_utility(self, nodes, visited_nodes):
		visited_nodes.add(nodes)
		for neighbour in self.graph[nodes]:
			if neighbour not in visited_nodes:
				self.dfs_utility(neighbour, visited_nodes)
			else:
				return neighbour

	def dfs(self, node):
		Visited = set()
		self.dfs_utility(node, Visited)

	def bfs(self, node):
		visited = set()
		if node not in visited:
			queue.append(node)
			visited.add(node)
		while queue:
			parent = queue.popleft()
			print(parent)
			for item in self.graph[parent]:
				if item not in visited:
					queue.append(item)
					visited.add(item)

def rounding(n):
	return int(decimal.Decimal(f'{n}').to_integral_value())

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def inp():
	return sys.stdin.readline().strip()

def map_inp(v_type):
	return map(v_type, inp().split())

def list_inp(v_type):
	return list(map_inp(v_type))
for _ in range(int(inp())):
	n = int(inp())
	print(n)
	print(*[item for item in range(1, n + 1)])


inn = lambda : int(input())
inm = lambda : map(int, input().split())
ins = lambda : str(input())
ina = lambda : list(map(int, input().split()))

def solve():
	n = inn()
	print(n)
	print(*[i for i in range(1, n + 1)])

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()
main()


x = int(input())
for i in range(0, x):
	n = int(input())
	ar = []
	for j in range(0, n):
		ar.append(j + 1)
	print(n)
	print(*ar)


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from operator import add, mul, sub, xor, truediv, floordiv
from functools import *
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, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa = ifa[::-1]

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def binfun(x):
	c = 0
	for w in arr:
		c += ceil(w / x)
	return c

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] < self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		for v in graph[u]:
			if v not in d or d[v] > d[u] + graph[u][v]:
				d[v] = d[u] + graph[u][v]
				heappush(heap, (d[v], v))
	return d

def GP(it):
	return [(ch, len(list(g))) for (ch, g) in groupby(it)]

class DLN:

	def __init__(self, val):
		self.val = val
		self.pre = None
		self.next = None
t = N()
for i in range(t):
	n = N()
	ans = list(range(1, n + 1))
	print(n)
	print(*ans)


import io
import os
from collections import Counter, defaultdict, deque

def solve(N):
	return str(N) + '\n' + ' '.join((str(i + 1) for i in range(N)))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(N,) = [int(x) for x in input().split()]
	ans = solve(N)
	print(ans)


def solve():
	n = int(input())
	print(n)
	for i in range(1, n + 1):
		print(i, end=' ')
	print(end='\n')
t = int(input())
for _ in range(t):
	solve()


def solve(n):
	print(n)
	print(*list(range(1, n + 1)))
t = int(input())
for i in range(t):
	n = int(input())
	solve(n)


from sys import stdin
from math import *
input = stdin.readline
for __ in range(int(input())):
	n = int(input())
	print(n)
	for i in range(n):
		print(i + 1, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	print(n)
	(start, incr) = (1, 2)
	for i in range(n):
		print(i + 1, end=' ')
	print()


import sys
t = int(input())
for i in range(t):
	n = int(input())
	ans = [int(i) for i in range(1, n + 1)]
	print(len(ans))
	print(*ans)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	print(n)
	ans = []
	for i in range(1, n + 1):
		ans.append(i)
	print(*ans)


k = input()
for i in range(int(k)):
	n = int(input())
	print(n)
	for x in range(1, n):
		print(str(x) + ' ', end='')
	print(n)


import sys
from math import *
from collections import Counter as cc, defaultdict as df, OrderedDict as od
inf = float('inf')

def counter(l):
	return dict(cc(l))

def lcm(a, b):
	return int(a * b / gcd(a, b))

def yes():
	print('YES')

def no():
	print('NO')

def so(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def rev(l):
	return list(reversed(l))

def ini():
	return int(sys.stdin.readline())

def inp():
	return map(int, sys.stdin.readline().strip().split())

def li():
	return list(map(int, sys.stdin.readline().strip().split()))

def i1():
	return sys.stdin.readline().strip()
for i in range(ini()):
	n = ini()
	print(n)
	print(*[i for i in range(1, n + 1)])


t = int(input())
for tt in range(t):
	n = int(input())
	print(n)
	for _ in range(n):
		print(_ + 1, end=' ')
	print('')


t = int(input())
for _ in range(t):
	n = int(input())
	print(n - 1)
	print(' '.join([str(x) for x in range(2, n + 1)]))


from sys import stdin, stdout
from collections import Counter
from math import ceil
from bisect import bisect_left
from bisect import bisect_right

def ai():
	return list(map(int, stdin.readline().split()))

def ei():
	return map(int, stdin.readline().split())

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
for _ in range(ip()):
	n = ip()
	print(n)
	print(*[i for i in range(1, n + 1)])


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	print(n - 1, '\n'.join([str(_) for _ in range(2, n + 1)]))


t = int(input())
for y in range(t):
	n = int(input())
	print(n - 1)
	for y in range(2, n + 1):
		print(y, end=' ')
	print()


t = int(input())
for k in range(t):
	n = int(input())
	ls = list(range(1, n + 1))
	print(len(ls))
	print(' '.join(map(str, ls)))


from math import *
from sys import *
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	x = n - 1
	i = 2
	print(x)
	a = []
	while i <= n:
		a.append(i)
		i += 1
	print(*a)


def ser(n):
	blanck = [n] * n
	print(n)
	for i in range(1, n + 1):
		print(i, end=' ')
	return ''
t = int(input())
for i in range(t):
	print(ser(int(input())))


from math import *
from bisect import *
from collections import *
from random import *
from decimal import *
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	n = inp()
	print(n)
	for i in range(n):
		print(i + 1, end=' ')
	print()


from sys import stdin, gettrace
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	n = int(inputi())
	print(n)
	print(' '.join(map(str, range(1, n + 1))))

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


t = int(input())
for i in range(t):
	n = int(input())
	print(n - 1)
	for i in range(2, n + 1):
		if i == n:
			print(i)
			continue
		print(i, ' ')


t = int(input())
for test in range(t):
	n = int(input())
	print(n)
	a = [i for i in range(1, n + 1)]
	print(' '.join((str(e) for e in a)))


for _ in range(int(input())):
	n = int(input())
	print(n - 1)
	temp = []
	for i in range(2, n + 1):
		temp.append(i)
	print(*temp)


import itertools
import math
import sys
import os
from collections import defaultdict

def is_debug():
	return 'PYPY3_HOME' not in os.environ

def stdin_wrapper():
	data = '2\n2\n3\n\n\n'
	for line in data.split('\n'):
		yield line
if not is_debug():

	def stdin_wrapper():
		while True:
			yield sys.stdin.readline()
inputs = stdin_wrapper()

def input_wrapper():
	return next(inputs)

def get_str():
	if is_debug():
		return input_wrapper()
	return input()

def get(_type):
	if _type == str:
		return get_str()
	return _type(input_wrapper())

def get_arr(_type):
	return [_type(x) for x in input_wrapper().split()]

def tuplerize(method):

	def wrap(*args, **kwargs):
		res = method(*args, **kwargs)
		if not isinstance(res, (tuple, list)):
			res = (res,)
		return res
	return wrap

@tuplerize
def solve(n):
	return '{}\n{}'.format(n, ' '.join(map(str, range(1, n + 1))))
t = get(int)
for _ in range(t):
	n = get(int)
	print(*solve(n))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	n = inp()
	print(n)
	for i in range(1, n + 1):
		print(i, end=' ')
	print()


import copy
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, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def exgcd(a, b):
	if not b:
		return (1, 0)
	(y, x) = exgcd(b, a % b)
	y -= a // b * x
	return (x, y)

def getinv(a, m):
	(x, y) = exgcd(a, m)
	return --1 if x == 1 else x % m

def comb(n, b):
	res = 1
	b = min(b, n - b)
	for i in range(b):
		res = res * (n - i) * getinv(i + 1, mo) % mo
	return res % mo
t = int(input())
for ti in range(t):
	n = int(input())
	print(n - 1)
	print(*range(2, n + 1))


for _ in range(int(input())):
	n = int(input())
	arr = list(range(1, n + 1))
	print(len(arr))
	print(*arr)


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2, floor
from bisect import bisect_right, bisect_left, bisect
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def isPowerOfTwo(x):
	return x and (not x & x - 1)
MOD = 1000000007
PMOD = 998244353
N = 10 ** 9 + 7
LOGN = 30
T = 1
T = int(stdin.readline())
for _ in range(T):
	n = int(stdin.readline())
	print(n)
	for i in range(n):
		print(i + 1, end=' ')
	print()


test = int(input())
for t in range(test):
	n = int(input())
	print(n)
	arr = [str(i + 1) for i in range(n)]
	print(' '.join(arr))


for tt in range(int(input())):
	n = int(input())
	print(n)
	for i in range(1, n + 1):
		print(i, end=' ')
	print()


for t in range(int(input())):
	n = int(input())
	ans = [i + 1 for i in range(n)]
	print(n)
	print(*ans)


import sys
input = sys.stdin.readline

def prog():
	for _ in range(int(input())):
		n = int(input())
		print(n)
		a = [i for i in range(1, n + 1)]
		print(*a)
prog()


cases = int(input())
while cases:
	cases -= 1
	num = int(input())
	print(num)
	print(*list(range(1, num + 1)))


t = int(input())
for i in range(t):
	n = int(input())
	l = list(range(1, n + 1))
	print(n)
	print(*l)


t = int(input())
for q in range(t):
	n = int(input())
	ch = ''
	for i in range(1, n + 1):
		ch += str(i) + ' '
	print(n)
	print(ch)


import sys, os
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
from itertools import permutations
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))
MOD = 10 ** 9 + 7

def main():
	for _ in range(int(input())):
		n = int(input())
		print(n - 1)
		print(*[i for i in range(2, n + 1)])
main()


for _ in range(int(input())):
	b = int(input())
	k = [i for i in range(1, b + 1)]
	print(len(k))
	print(*k)


t = int(input())
while t:
	t -= 1
	n = int(input())
	print(n - 1)
	print(*range(2, n + 1))


for _ in range(int(input())):
	k = int(input())
	print(k)
	print(*list(range(1, k + 1)))


a = int(input())
for x in range(a):
	b = int(input())
	print(b - 1)
	for y in range(2, b + 1):
		print(y, end=' ')
	print()


for i in range(int(input())):
	n = int(input())
	print(n)
	for j in range(n):
		print(j + 1, end=' ')
	print('\n')


import math
import sys
t = int(input())
while t:
	t -= 1
	n = int(input())
	sys.stdout.write(str(n) + '\n')
	for i in range(1, n + 1):
		sys.stdout.write(str(i) + ' ')
	sys.stdout.write('\n')


t = int(input())
for i in range(t):
	n = int(input())
	if n == 2:
		print(1)
		print(2)
	else:
		a = []
		print(n)
		for j in range(1, n + 1):
			a.append(j)
		print(*a)


import sys
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
from math import *
for _ in range(ii1()):
	n = ii1()
	print(n)
	for i in range(1, n + 1):
		if i == n:
			print(i)
		else:
			print(i, end=' ')


n = int(input())
for i in range(n):
	m = int(input())
	print(m - 1)
	print(*list(range(2, m + 1)))


t = int(input())

def solve():
	n = int(input())
	print(n)
	a = 1
	while a <= n:
		print(a, end=' ')
		a += 1
while t > 0:
	solve()
	print('')
	t -= 1


import sys, io, os, time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
for ii in range(int(input())):
	n = int(input())
	print(n)
	print(*[i for i in range(1, n + 1)])


a = int(input())
for i in range(a):
	x = int(input())
	l = []
	for g in range(1, x + 1):
		l.append(str(g))
	print(len(l))
	print(' '.join(list(l)))


tests = int(input())
for test in range(1, tests + 1):
	n = int(input())
	print(n)
	ans = ''
	for i in range(1, n + 1):
		ans += str(i)
		ans += ' '
	print(ans)


for _ in range(int(input())):
	n = int(input())
	print(n - 1)
	l = [i + 2 for i in range(n - 1)]
	print(' '.join([str(x) for x in l]))


x = int(input())
ansl = []
for i in range(x):
	n = int(input())
	ans = []
	for i in range(2, n + 1):
		ans.append(i)
	ansl.append([n - 1])
	ansl.append(ans)
for i in ansl:
	print(*i)


import math
k = int(input())
while k > 0:
	n = int(input())
	print(str(n))
	for i in range(1, n + 1):
		print(i, end=' ')
	print('')
	k = k - 1


def fun(n):
	print(n)
	print(*range(1, n + 1))
T = int(input())
for i in range(T):
	t = int(input())
	fun(t)


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	ans = [i for i in range(2, n + 1)]
	print(len(ans))
	print(' '.join((str(i) for i in ans)))


def solve(n):
	print(n)
	return [i for i in range(1, n + 1)]
t = int(input())
while t:
	n = int(input())
	print(*solve(n))
	t -= 1


for i in range(int(input())):
	a = int(input())
	print(a - 1)
	print(*range(2, a + 1))


import sys
input = sys.stdin.buffer.readline
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rs = lambda : input().decode().rstrip('\n\r')
wrt = sys.stdout.write
pr = lambda *args, end='\n': wrt(' '.join([str(x) for x in args]) + end)
xrange = lambda args: reversed(range(args))
cdiv = lambda x, y: -(-x // y)
enum = enumerate
inf = float('inf')
mod = 10 ** 9 + 7
from collections import defaultdict as dd
Cases = ri()
for Case in range(Cases):
	n = ri()
	print(n)
	print(*[i for i in range(1, n + 1)])


T = int(input())
for z in range(T):
	n = int(input())
	print(n - 1)
	for i in range(n - 1):
		print(i + 2, end=' ')
	print('')


def read_int():
	n = int(input())
	return n

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve(n):
	sol = []
	sol.append(n)
	sol.append(list(range(1, n + 1)))
	return sol
t = read_int()
for case in range(t):
	n = read_int()
	sol = solve(n)
	print(sol[0])
	print(' '.join([str(x) for x in sol[1]]))


MOD = 1000000007
from collections import defaultdict as dd, Counter, deque

def si():
	return input()

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())

def out(v):
	print(v)

def spout():
	print(v, end=' ')

def d2b(n):
	return bin(n).replace('0b', '')

def twod(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def vow():
	return ['a', 'e', 'i', 'o', 'u']

def let():
	return [chr(i) for i in range(97, 123)]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ispow2(x):
	return x and (not x & x - 1)

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def func(n):
	i = 1
	while i + 2 <= n:
		print(i, i + 1, i + 2)
		i += 2
		if i == n or i == n - 1:
			break
	i = 1
	while i + 3 < n:
		if n % 2 == 0:
			print(i, i + 1, n - 1)
		else:
			print(i, i + 1, n)
		i += 2
t = ii()
while t:
	t -= 1
	n = ii()
	print(n - 1)
	for i in range(2, n + 1):
		print(i, end=' ')
	print()


for z in range(int(input())):
	n = int(input())
	print(n)
	for i in range(n):
		print(i + 1, end=' ')
	print()


t = int(input())
answer = []
for _ in range(t):
	n = int(input())
	list = [str(i + 1) for i in range(n)]
	answer.append(str(n) + '\n' + ' '.join(list))
print('\n'.join(answer))


import math
from collections import deque
from sys import stdin, stdout, setrecursionlimit
from string import ascii_letters
letters = ascii_letters[:26]
from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	print(n - 1)
	print(*[i + 1 for i in range(1, n)])


for tetscase in range(int(input())):
	n = int(input())
	print(n)
	for i in range(1, n + 1):
		print(i, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	print(n)
	arr = [i + 1 for i in range(n)]
	print(*arr)


import math
for _ in range(int(input())):
	n = int(input())
	ans = []
	for i in range(2, n + 1):
		ans.append(i)
	print(len(ans))
	print(*ans)


from sys import stdin, stdout
from collections import *
from math import *
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	n = inp()
	ans = [i for i in range(1, n + 1)]
	pr(len(ans))
	print(*ans)
for _ in range(inp()):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	print(n - 1)
	l = []
	for j in range(2, n + 1):
		l.append(j)
	print(*l)


m = int(input())
l = []
for _ in range(m):
	t = int(input())
	s = ''
	le = 0
	for i in range(1, t + 1):
		s += f'{i} '
		le += i
	l.append(t)
	l.append(s)
for i in l:
	print(i)


for s in [*open(0)][1:]:
	print(int(s))
	print(*[x + 1 for x in range(int(s))])


import sys
import math
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	print(n)
	for i in range(1, n + 1):
		print(i, end=' ')
	print()


from sys import stdin

def u():
	return [int(i) for i in next(stdin).split()]
t = int(input())
for _ in range(t):
	n = int(input())
	j = n
	print(j)
	ans = ''
	for i in range(1, j + 1):
		ans += str(i) + ' '
	print(ans)


t = int(input())

def solve():
	b = int(input())
	print(b)
	print(' '.join([str(i) for i in range(1, b + 1)]))
for i in range(t):
	solve()


T = int(input())
for _ in range(T):
	N = int(input())
	print(N)
	print(*range(1, N + 1))


for _ in range(int(input())):
	(lambda x: print(str(x) + '\n' + ' '.join(map(str, range(1, x + 1)))))(int(input()))


import sys
input = sys.stdin.buffer.readline

def solution():
	n = int(input())
	print(n)
	l = []
	for i in range(1, n + 1):
		l.append(i)
	print(*l)
t = int(input())
for _ in range(t):
	solution()


for _ in [0] * int(input()):
	k = int(input())
	print(k)
	print(*[i + 1 for i in range(k)])


import sys
t = int(input())
for num in range(t):
	n = int(sys.stdin.readline())
	ls = []
	for num2 in range(1, n + 1):
		ls.append(str(num2))
	print(n)
	print(' '.join(ls))