Tenka1 Programmer Beginner Contest - Crossing

You are given an integer N. Determine if there exists a tuple of subsets of \\{1,2,...N\\}, (S_1,S_2,...,S_k), that satisfies the following conditions:

* Each of the integers 1,2,...,N is contained in exactly two of the sets S_1,S_2,...,S_k.
* Any two of the sets S_1,S_2,...,S_k have exactly one element in common.



If such a tuple exists, construct one such tuple.

Constraints

* 1 \leq N \leq 10^5
* N is an integer.

Input

Input is given from Standard Input in the following format:


N


Output

If a tuple of subsets of \\{1,2,...N\\} that satisfies the conditions does not exist, print `No`. If such a tuple exists, print `Yes` first, then print such subsets in the following format:


k
|S_1| S_{1,1} S_{1,2} ... S_{1,|S_1|}
:
|S_k| S_{k,1} S_{k,2} ... S_{k,|S_k|}


where S_i={S_{i,1},S_{i,2},...,S_{i,|S_i|}}.

If there are multiple such tuples, any of them will be accepted.

Examples

Input

3


Output

Yes
3
2 1 2
2 3 1
2 2 3


Input

4


Output

No

Source: atcoder | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
N = int(input())
k = 1
n = 0
while n < N:
	n += k
	k += 1
if n != N:
	print('No')
	exit()
print('Yes')
print(k)
ans = [[] for _ in range(k)]
v = 1
for i in range(k - 1):
	for j in range(i + 1, k):
		ans[i].append(v)
		ans[j].append(v)
		v += 1
for row in ans:
	print(*[len(row)] + row)


from itertools import combinations as cb
n = int(input())
k = 0
for i in range(1, 1000):
	if i * (i - 1) // 2 == n:
		k = i
if k == 0:
	print('No')
	exit()
print('Yes')
print(k)
x = list(cb([i for i in range(k)], 2))
dp = [[] for i in range(k)]
for (i, (a, b)) in enumerate(x):
	dp[a].append(i + 1)
	dp[b].append(i + 1)
for r in dp:
	print(len(r), *r)


(n, k) = (int(input()), 0)
for i in range(int((2 * n) ** 0.5) + 10):
	if i * (i - 1) == 2 * n:
		k = i
if k == 0:
	print('No')
else:
	print('Yes')
	print(k)
	c = 1
	a = [[0] * k for _ in range(k)]
	for i in range(1, k):
		for j in range(1, i + 1):
			a[i][j] = c
			c += 1
	ans = [[k - 1] + [a[i][i] for i in range(1, k)]]
	for i in range(1, k):
		l = [k - 1]
		(h, w) = (i, 1)
		for j in range(1, k):
			l.append(a[h][w])
			(h, w) = (h, w + 1) if j < i else (h + 1, w)
		ans.append(l)
	for i in ans:
		print(*i)


n = int(input())
f = True
r = 0
i = 1
while r < n:
	i += 1
	r = i * (i - 1) // 2
	if r == n:
		f = False
if f:
	print('No')
else:
	ans = [[] for j in range(i)]
	j = 1
	for a in range(i):
		for b in range(a + 1, i):
			ans[a].append(j)
			ans[b].append(j)
			j += 1
	print('Yes')
	print(i)
	for a in range(i):
		print(' '.join(map(str, [len(ans[a])] + ans[a])))


n = int(input())
i = 1
cnt = 1
flag = False
while True:
	cnt += 1
	if i == n:
		flag = True
		break
	if i > n:
		break
	i += cnt
if not flag:
	print('No')
	exit()
print('Yes')
print(cnt)
li = [[] for i in range(cnt)]
num = 1
for i in range(cnt):
	tmp_num = num
	for _ in range(cnt - i - 1):
		li[i].append(tmp_num)
		tmp_num += 1
	for j in range(i + 1, cnt):
		li[j].append(num)
		num += 1
for li2 in li:
	print(len(li2), *li2)


def chk(k):
	if k * (k - 1) // 2 != n:
		return False
	l = [[] for i in range(k)]
	x = 1
	for i in range(k):
		for j in range(i + 1, k):
			l[i].append(x)
			l[j].append(x)
			x += 1
	print('Yes\n' + str(k))
	for i in range(k):
		print(len(l[i]), ' '.join(map(str, l[i])))
	return True
n = int(input())
flag = False
for i in range(1, 1000):
	if chk(i):
		flag = True
		exit()
if not flag:
	print('No')


N = int(input())
ss = [[1], [1]]
n = 2
for i in range(1, N):
	l = i + 1
	ss = [ss[i] + [n + i] for i in range(l)]
	ss += [[n + i for i in range(l)]]
	n += l
	if n - 1 >= N:
		break
if n - 1 == N:
	print('Yes')
	print(len(ss))
	for r in ss:
		print(len(r), *r)
else:
	print('No')


n = int(input())
num_e = 1
num = num_e ** 2 + num_e
l = []
ok = 0
while num // 2 <= 10 ** 5:
	if num // 2 == n:
		ok = 1
		break
	num_e += 1
	num = num_e ** 2 + num_e
if not ok:
	print('No')
else:
	print('Yes')
	ans = [[num_e] for i in range(num_e + 1)]
	num = 1
	for i in range(num_e):
		for j in range(i + 1):
			ans[j].append(num)
			ans[i + 1].append(num)
			num += 1
	print(num_e + 1)
	for i in range(num_e + 1):
		print(' '.join(map(str, ans[i])))


N = int(input())
K = -1
for k in range(N + 1):
	if k * (k - 1) // 2 == N:
		K = k
		break
	elif k * (k - 1) // 2 > N:
		break
if N == 1:
	print('Yes')
	print(2)
	print(1, 1)
	print(1, 1)
elif K == -1:
	print('No')
else:
	print('Yes')
	print(K)
	n = 0
	S = [[] for _ in range(K)]
	for i in range(K):
		for j in range(i + 1, K):
			n += 1
			S[i].append(n)
			S[j].append(n)
	for s in S:
		print(len(s), ' '.join([str(a) for a in s]))


n = int(input())
k = (1 + (1 + 8 * n) ** 0.5) * 0.5
if k.is_integer():
	k = int(k)
	print('Yes')
	print(k)
	(num, ans) = (1, [[] for _ in range(k)])
	for i in range(k):
		for j in range(i + 1, k):
			ans[i].append(num)
			ans[j].append(num)
			num += 1
		print(k - 1, *ans[i])
else:
	print('No')


from itertools import combinations
n = int(input())
yes = [i * (i - 1) // 2 for i in range(2, 448)]
if n in yes:
	print('Yes')
	len_s = yes.index(n) + 1
	print(len_s + 1)
	res = [[] for _ in range(len_s + 1)]
	for (i, v) in enumerate(combinations(range(len_s + 1), 2)):
		res[v[0]].append(str(i + 1))
		res[v[1]].append(str(i + 1))
	for r in res:
		print(' '.join([str(len_s)] + r))
else:
	print('No')


N = int(input())
stock = [N - i for i in range(N)]
N *= 2
n = -int(-N ** 0.5 // 1)
if N / n == N // n and n - N // n == 1:
	yoko = N // n
else:
	print('No')
	exit()
ans = [[0 for j in range(yoko)] for i in range(n)]
for i in range(N - 1):
	for j in range(i, yoko):
		temp = stock.pop(-1)
		ans[i][j] = temp
		ans[j + 1][i] = temp
print('Yes')
print(len(ans))
for item in ans:
	print(len(item), *item)


def main():
	n = int(input())
	for k in range(1, 450):
		if k * (k + 1) == 2 * n:
			print('Yes')
			print(k + 1)
			break
	else:
		print('No')
		return 0
	ans = []
	cnt = 1
	for i in range(k + 1):
		ans.append([])
		for j in range(i):
			ans[i].append(ans[j][i - 1])
		for j in range(i, k):
			ans[i].append(cnt)
			cnt += 1
	for i in ans:
		print(len(i), *i)
main()


n = int(input())
k = 1
t = 0
while t < n:
	t += k
	k += 1
if t != n:
	print('No')
	exit(0)
print('Yes')
print(k)
a = [[] for _ in range(k)]
val = 1
for i in range(k - 1):
	for j in range(i + 1, k):
		a[i].append(val)
		a[j].append(val)
		val += 1
for aa in a:
	print(*[len(aa)] + aa)


n = int(input())
for i in range(1, 1000):
	if i * (i + 1) == n * 2:
		print('Yes')
		k = i + 1
		print(k)
		break
else:
	print('No')
	quit()
ans = [[0] * (k - 1) for i in range(k)]
x = 1
for i in range(k - 1, 0, -1):
	for j in range(i):
		ans[-i - 1][-j - 1] = x
		ans[-i + j][-i] = x
		x += 1
for i in ans:
	print(k - 1, ' '.join(map(str, i)))


n = int(input())
k = 2
while 2 * n > k * (k - 1):
	k += 1
if 2 * n != k * (k - 1):
	print('No')
else:
	print('Yes')
	print(k)
	tmp = 0
	result = [[0] * (k - 1) for i in range(k)]
	for i in range(k):
		for j in range(i):
			result[i][j] = result[j][i - 1]
		for l in range(k - i - 1):
			tmp += 1
			result[i][i + l] = tmp
	for j in range(k):
		print('{} '.format(k - 1), end='')
		for i in range(k - 2):
			print('{} '.format(result[j][i]), end='')
		print(result[j][k - 2])


n = int(input())
A = []
for i in range(1, int(n ** 0.5 + 3) * 2):
	A.append(i * (i - 1) // 2)
if n in A:
	print('Yes')
	x = A.index(n) + 1
	ans = [[] for _ in range(x)]
	now = 1
	l = 0
	while l < x:
		for i in range(x - l - 1):
			ans[l].append(now)
			ans[l + 1 + i].append(now)
			now += 1
		l += 1
	print(x)
	for i in range(x):
		print(x - 1, *ans[i])
else:
	print('No')


import math
N = int(input())
q = int(math.sqrt(N * 2))
if N * 2 != q * q + q:
	print('No')
	exit()
S = [list(range(1, q + 1))]
for j in range(1, q + 1):
	S.append([j])
last = q
for i in range(1, q):
	r = list(range(last + 1, last + 1 + q - i))
	S[i] += r
	for j in range(q - i):
		S[i + j + 1] += [r[j]]
	last = r[-1]
print('Yes')
print(len(S))
for s in S:
	print(len(s), ' '.join(map(str, s)))


N = int(input())
num = 0
ans = 'No'
for i in range(1, 10 ** 3):
	if i * (i + 1) > 2 * N:
		break
	elif i * (i + 1) == 2 * N:
		num = i
		ans = 'Yes'
		break
print(ans)
if ans == 'Yes':
	print(num + 1)
	arr = [[num] for i in range(num + 1)]
	n = 1
	for i in range(num + 1):
		j = 1
		while len(arr[i]) != num + 1:
			arr[i].append(n)
			arr[i + j].append(n)
			j += 1
			n += 1
	for a in arr:
		print(a[0], end='')
		for x in a[1:]:
			print(' {}'.format(x), end='')
		print('')


n = int(input())
a = []
for i in range(1, 500):
	a.append(i * (i - 1) // 2)
if n in a:
	print('Yes')
	x = a.index(n) + 1
	ans = [[] for _ in range(x)]
	now = 1
	l = 0
	while l < x:
		for i in range(x - l - 1):
			ans[l].append(now)
			ans[l + 1 + i].append(now)
			now += 1
		l += 1
	print(x)
	for i in range(x):
		print(x - 1, *ans[i])
else:
	print('No')


N = int(input())
k = int((2 * N) ** 0.5) + 1
if 2 * N == k * (k - 1):
	print('Yes')
	A = [[0 for _ in range(k + 1)] for _ in range(k + 1)]
	cnt = 1
	for i in range(1, k):
		for j in range(i + 1, k + 1):
			A[i][j] = cnt
			A[j][i] = A[i][j]
			cnt += 1
	S = [[] for _ in range(k + 1)]
	for i in range(1, k + 1):
		for j in range(1, k + 1):
			if i != j:
				S[i].append(A[i][j])
	print(k)
	for i in range(1, k + 1):
		print(k - 1, *S[i])
else:
	print('No')


from math import ceil
n = int(input())
k = ceil((2 * n) ** 0.5)
if k * (k - 1) // 2 != n:
	print('No')
	exit()
S = [[] for _ in range(k)]
a = 1
for i in range(k):
	for j in range(i + 1, k):
		S[i].append(a)
		S[j].append(a)
		a += 1
print('Yes')
print(k)
for i in range(k):
	print(len(S[i]), *S[i])


n = int(input())
k = int((n * 2) ** 0.5) + 1
if (k - 1) * k / 2 == n:
	print('Yes')
	print(k)
else:
	print('No')
	exit()
t = [1] * (k - 1)
for i in range(1, k - 1):
	t[i] = t[i - 1] + i
for i in range(k - 1):
	s = (t[max(i, j)] + min(i, j) for j in range(k - 1))
	print(k - 1, *s)
print(k - 1, *(t[j] + j for j in range(k - 1)))


n = int(input())
m = -1
for i in range(3, 1000, 2):
	if i * i == 8 * n + 1:
		m = (1 + i) // 2
if m == -1:
	print('No')
	exit(0)
cnt = 1
s = [[0] for _ in range(m + 1)]
for i in range(1, m + 1):
	for j in range(i + 1, m + 1):
		s[i][0] += 1
		s[j][0] += 1
		s[i].append(cnt)
		s[j].append(cnt)
		cnt += 1
print('Yes')
print(m)
for i in range(1, m + 1):
	print(' '.join([str(c) for c in s[i]]))


N = int(input())
n = int((2 * N) ** 0.5)
if n * (n + 1) == 2 * N:
	print('Yes')
	print(n + 1)
	S = [[] for _ in range(n + 1)]
	num = 1
	for i in range(n + 1):
		j = i + 1
		while len(S[i]) < n:
			S[i].append(str(num))
			S[j].append(str(num))
			num += 1
			j += 1
	for i in range(n + 1):
		print(n, ' '.join(S[i]))
else:
	print('No')


from itertools import combinations
N = int(input())
k = 1
while k ** 2 - k < 2 * N:
	k += 1
if k ** 2 - k != 2 * N:
	print('No')
else:
	print('Yes')
	print(k)
	sets = [[] for _ in range(k)]
	n = 1
	for (i, j) in combinations(range(k), 2):
		sets[i].append(n)
		sets[j].append(n)
		n += 1
	for S in sets:
		print(len(S), *S)


n = int(input())
p = int((2 * n) ** 0.5)
if n != (p + 1) * p // 2:
	print('No')
else:
	t = [[] for i in range(p + 1)]
	c = 1
	for i in range(1, p + 1):
		for j in range(i):
			t[i].append(c)
			t[j].append(c)
			c += 1
	print('Yes')
	print(p + 1)
	for i in t:
		i = [len(i)] + i
		print(*i)


import itertools
N = int(input())
k = int((2 * N) ** 0.5) + 1
if (k - 1) * k == 2 * N:
	print('Yes')
	print(k)
	S = [[] for _ in range(k)]
	n = 1
	for (i, j) in itertools.combinations(range(k), 2):
		S[i].append(str(n))
		S[j].append(str(n))
		n += 1
	for s in S:
		print(len(s), ' '.join(s))
else:
	print('No')


from math import sqrt
x = int(input())
n = (sqrt(8 * x + 1) - 1) / 2
if int(n) == n:
	n = int(n)
	a = [[1], [1]]
	for i in range(2, n + 1):
		ti = i * (i + 1) // 2
		b = list(range(ti + 1 - i, ti + 1))
		for (j, v) in enumerate(b):
			a[j].append(v)
		a.append(b)
	print('Yes')
	print(len(a))
	for b in a:
		print(len(b), *b)
else:
	print('No')


import sys
from math import sqrt, ceil
N = int(input())
k = ceil(sqrt(2 * N))
if k * (k - 1) != 2 * N:
	print('No')
	sys.exit()
S = [[] for _ in range(k + 1)]
num = 1
for i in range(1, k):
	for j in range(i + 1, k + 1):
		S[i].append(num)
		S[j].append(num)
		num += 1
print('Yes')
print(k)
for i in range(1, k + 1):
	print(len(S[i]), ' '.join(map(str, S[i])))


N = int(input())
flag = 0
for i in range(int(N ^ 1 // 2) + 1):
	if N * 2 == i * (i + 1):
		flag = 1
		d = i
		break
if flag == 0:
	print('No')
	exit(0)
ls = [[0 for _ in range(d)] for _ in range(d + 1)]
for i in range(d):
	ls[0][i] = i + 1
for j in range(1, d + 1):
	for i in range(j):
		ls[j][i] = ls[j - i - 1][j - 1]
	for i in range(d - j):
		ls[j][i + j] = i + max(ls[j - 1]) + 1
print('Yes')
print(d + 1)
for i in range(len(ls)):
	print(d, end=' ')
	for j in ls[i]:
		print(j, end=' ')
	print()


from math import sqrt
n = int(input())
k = (1 + sqrt(1 + 8 * n)) / 2
if k.is_integer():
	print('Yes')
	k = int(k)
	ans = [set() for _ in range(k)]
	i = 1
	for j in range(k - 1):
		for l in range(j + 1, k):
			ans[j].add(i)
			ans[l].add(i)
			i += 1
	print(k)
	for a in ans:
		print(k - 1, ' '.join(map(str, a)))
else:
	print('No')


n = int(input())
ok = False
x = 0
for i in range(1000):
	if n == i * (i + 1) // 2:
		ok = True
		x = i
		break
if ok:
	print('Yes')
	d = n * 2 // x
	print(d)
	a = [[] for _ in range(d)]
	a[0].append(1)
	a[1].append(1)
	now = 1
	for i in range(2, d):
		for j in range(i):
			a[j].append(now + j + 1)
		for j in range(i):
			a[i].append(now + j + 1)
		now += i
	for i in range(d):
		print(x, *a[i])
else:
	print('No')


n = int(input())
if n == 1:
	print('Yes')
	print(2)
	print(1, 1)
	print(1, 1)
	exit()
i = 1
k = -1
while i <= n:
	if n == i * (i - 1) // 2:
		k = i
		break
	i += 1
if k == -1:
	print('No')
	exit()
ans = [[] for _ in range(k)]
anss = 1
for i in range(k - 1):
	for j in range(k - i - 1):
		ans[i].append(anss)
		ans[i + j + 1].append(anss)
		anss += 1
print('Yes')
print(k)
for i in ans:
	print(k - 1, end=' ')
	print(*i)


N = int(input())
for i in range(N + 1):
	if i * (i + 1) // 2 == N:
		M = i
		print('Yes')
		print(M + 1)
		res = [[] for _ in range(M + 1)]
		for i in range(M + 1):
			res[i].append(M)
		cnt = 1
		for k in range(M):
			for i in range(M - k):
				res[k].append(cnt + i)
			for i in range(M - k):
				res[k + i + 1].append(cnt)
				cnt += 1
		for r in res:
			print(*r)
		break
else:
	print('No')


n = int(input())
if n == 1:
	print('Yes')
	print(2)
	print(1, 1)
	print(1, 1)
	exit()
if n == 2:
	print('No')
	exit()
a = [[1]]
i = 1
for j in range(1, n):
	a.append(list(range(i, i + j)))
	if n == i + j - 1:
		break
	elif i + j > n:
		print('No')
		exit()
	i += j
print('Yes')
m = len(a)
for i in range(m - 1):
	for j in range(i + 1 + (i < 1), m):
		a[i].append(a[j][i])
print(m)
for b in a:
	print(len(b), *b)


n = int(input())
for i in range(1, 1000 + 1):
	if n == i * (i - 1) // 2:
		k = i
		break
else:
	print('No')
	exit()
s = [[] for _ in range(k + 1)]
num = 0
for i in range(1, k):
	for j in range(i):
		num += 1
		s[i].append(num)
		if j == i - 1:
			s[k].append(num)
		else:
			s[j + 1].append(num)
print('Yes')
print(k)
for i in range(1, k + 1):
	print(k - 1, *s[i])


n = int(input())
if not ((1 + (1 + 8 * n) ** 0.5) / 2).is_integer():
	print('No')
else:
	k = int((1 + (1 + 8 * n) ** 0.5) // 2)
	ans = [[] for _ in range(k)]
	cnt = 1
	for i in range(k):
		for j in range(i + 1, k):
			ans[i].append(cnt)
			ans[j].append(cnt)
			cnt += 1
	print('Yes')
	print(k)
	for i in range(k):
		print(k - 1, *ans[i])


import sys
N = int(input())
s = 0
i = 1
x = 0
while s <= N:
	s += i
	if s == N:
		x = i
	i += 1
if x == 0:
	print('No')
	sys.exit()
print('Yes')
print(x + 1)
anslis = []
(i, j) = (0, 1)
while len(anslis) <= x:
	anslis.append([x])
n = 1
while n <= N:
	anslis[i].append(n)
	anslis[j].append(n)
	if j < x:
		j += 1
	else:
		i += 1
		j = i + 1
	n += 1
i = 0
for arrays in anslis:
	print(' '.join(map(str, arrays)))


import sys
input = sys.stdin.readline
N = int(input())
k = 0
for i in range(1, N + 2):
	if i * (i - 1) == N * 2:
		k = i
		break
if k == 0:
	print('No')
	exit(0)
res = [[] for _ in range(k + 1)]
p = 1
print('Yes')
print(k)
for i in range(2, k + 1):
	for j in range(1, i):
		res[i].append(p)
		res[j].append(p)
		p += 1
for i in range(1, k + 1):
	print(str(len(res[i])) + ' ' + ' '.join(list(map(str, res[i]))))


N = int(input())
x = (1 + (1 + 8 * N) ** 0.5) / 2
if x.is_integer():
	print('Yes')
	x = int(x)
	print(x)
	S = [[] for _ in range(x)]
	e = 1
	for i in range(x):
		for j in range(i + 1, x):
			S[i].append(e)
			S[j].append(e)
			e += 1
	for s in S:
		print(len(s), *s)
else:
	print('No')


N = int(input())
k = 1

def list_print(S):
	print(len(S), end='')
	for i in range(len(S)):
		print(' {}'.format(S[i]), end='')
	print('')
while k < 1000:
	if k * (k - 1) // 2 == N:
		break
	k += 1
if k == 1000:
	print('No')
else:
	S = [[] for _ in range(k)]
	i = 1
	for l in range(k):
		for r in range(l + 1, k):
			S[l].append(i)
			S[r].append(i)
			i += 1
	print('Yes')
	print(k)
	for i in range(k):
		list_print(S[i])


import sys
n = int(input())
for i in range(10000):
	if i * (i - 1) // 2 == n:
		ans = i
		break
	if i == 9999:
		print('No')
		sys.exit()
t = []
print('Yes')
print(ans)
for i in range(ans):
	t.append([])
current = 1
i = 1
while i <= n:
	for j in range(current, ans):
		t[j].append(str(i))
		t[current - 1].append(str(i))
		i += 1
	current += 1
for i in range(ans):
	print(len(t[i]))
	print(' '.join(t[i]))


from math import sqrt
n = int(input())
a = 1 + 8 * n
b = int(sqrt(a))
if b ** 2 != a or b % 2 == 0:
	print('No')
	exit()
else:
	k = (1 + b) // 2
	s = [[] for i in range(k)]
	cur = 1
	for i in range(k):
		for j in range(k - i - 1):
			s[i].append(cur)
			s[i + j + 1].append(cur)
			cur += 1
	print('Yes')
	print(k)
	for i in range(k):
		res = '{} '.format(len(s[i])) + ' '.join(map(str, s[i]))
		print(res)


import sys
from itertools import combinations
stdin = sys.stdin
ri = lambda : int(rs())
rl = lambda : list(map(int, stdin.readline().split()))
rs = lambda : stdin.readline().rstrip()
N = ri()
x = int((2 * N) ** 0.5)
if x * (x + 1) == 2 * N:
	print('Yes')
else:
	print('No')
	exit()
k = x + 1
num = 2 * N // k
answer = [[] for _ in range(k)]
for (i, (a, b)) in enumerate(combinations(range(k), 2), 1):
	answer[a].append(i)
	answer[b].append(i)
print(k)
for a in answer:
	print(num, *a)


import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7
INF = 10 ** 18
eps = 10 ** (-7)
N = int(readline())
k = -1
for i in range(1, 1000):
	if i * (i - 1) // 2 == N:
		k = i
		print('Yes')
		break
if k == -1:
	print('No')
	exit()
print(k)
ans = [[] for i in range(k)]
import itertools
for (i, (a, b)) in enumerate(itertools.combinations(range(k), 2), 1):
	ans[a].append(i)
	ans[b].append(i)
for aaa in ans:
	print(len(aaa), ' '.join(map(str, aaa)))


N = int(input())
flg = False
for i in range(N + 1):
	if i * (i + 1) // 2 == N:
		flg = True
		a = i
if flg == False:
	print('No')
	exit()
lis = [[0] * a for _ in range(a + 1)]
p = 0
for i in range(a + 1):
	for j in range(a):
		lis[i][j] = i * a + (j + 1) - p
	p += i + 1
for i in range(1, a + 1):
	for j in range(i):
		lis[i][j] = lis[j][i - 1]
print('Yes')
print(a + 1)
for i in range(a + 1):
	print(a, ' '.join(map(str, lis[i])))


import sys
N = int(input())
K = 1
while K * (K - 1) // 2 < N:
	K += 1
if K * (K - 1) // 2 != N:
	print('No')
	sys.exit(0)
vs = [[] for _ in range(K)]
k = 0
for i in range(K):
	for j in range(K):
		if i <= j:
			continue
		vs[i].append(k)
		vs[j].append(k)
		k += 1
print('Yes')
print(K)
for v in vs:
	print(len(v), end='')
	print(' ', end='')
	print(' '.join([str(x + 1) for x in v]))


MOD = 10 ** 9 + 7
INF = 10 ** 10

def main():
	N = int(input())
	K = 0
	for i in range(2, N + 2):
		if i * (i - 1) // 2 == N:
			K = i
			break
	if K == 0:
		print('No')
		return
	ans = [[0] * (K - 1) for _ in range(K)]
	before = 1
	for i in range(K - 1):
		for j in range(i, K - 1):
			ans[i][j] = before
			ans[j + 1][i] = before
			before += 1
	print('Yes')
	print(K)
	for i in range(K):
		print(len(ans[i]), *ans[i])
main()


N = int(input())
i = 1
K = []
while 1:
	k = i * (i + 1) // 2
	if k > 10 ** 5:
		break
	K.append(k)
	i += 1
if not N in K:
	print('No')
	exit()
print('Yes')
S = [[], []]
i = 0
for n in range(1, N + 1):
	S[i].append(n)
	S[-1].append(n)
	i += 1
	if n in K:
		if n == N:
			break
		i = 0
		S.append([])
print(len(S))
for s in S:
	print(str(len(s)) + ' ' + ' '.join(map(str, s)))


n = int(input())
if n == 1:
	print('Yes')
	print(2)
	print(1, 1)
	print(1, 1)
	exit(0)
for i in range(2, 1000):
	if i * (i + 1) // 2 > n:
		print('No')
		exit(0)
	if i * (i + 1) // 2 == n:
		break
q = list(range(n, 0, -1))
ans = []
for j in range(i + 1):
	tmp = []
	for k in ans:
		tmp.append(k[j - 1])
	for _ in range(i - j):
		tmp.append(q.pop())
	ans.append(tmp)
print('Yes')
print(i + 1)
for j in ans:
	tmp = [i] + j
	print(*tmp)


N = int(input())
K = int((2 * N) ** 0.5) + 1
if K * (K - 1) // 2 != N:
	print('No')
	quit()
print('Yes')
print(K)
A = [[] for _ in range(K - 1)]
cur = 1
for i in range(K - 1):
	for _ in range(i + 1):
		A[i].append(cur)
		cur += 1
for i in range(K - 1):
	T = A[i]
	cur = len(T) - 1
	for j in range(cur + 1, K - 1):
		T.append(A[j][cur])
	print(len(T), *T)
T = [A[i][i] for i in range(K - 1)]
print(len(T), *T)


n = int(input())
a = [0]
for i in range(1, 10 ** 5):
	a.append(a[-1] + i)
	if a[-1] >= n:
		break
if n != a[-1]:
	print('No')
	exit()
print('Yes')
k = len(a)
print(k)
s = [[] for _ in [0] * k]
cnt = 1
for i in range(1, k):
	ind = 0
	while cnt <= a[i]:
		s[i].append(cnt)
		s[ind].append(cnt)
		cnt += 1
		ind += 1
for i in range(k):
	print(len(s[i]), end=' ')
	for e in s[i]:
		print(e, end=' ')
	print('')


n = int(input())
t = int((n * 2) ** 0.5)
if t * (t + 1) // 2 != n:
	print('No')
	quit()
l = [[] for _ in range(t + 1)]
ind = 1
for i in range(t, 0, -1):
	for j in range(i):
		l[t - i].append(j + ind)
	for j in range(i):
		l[t - i + 1 + j].append(j + ind)
	ind += i
print('Yes')
print(t + 1)
for i in range(t + 1):
	print(t, *l[i])


N = int(input())
import itertools
d = {}
k = 1
while k * (k - 1) / 2 < 10 ** 5:
	d[int(k * (k - 1) / 2)] = k
	k += 1
if N not in d.keys():
	print('No')
else:
	print('Yes')
	k = d[N]
	output = [[] for _ in range(k)]
	print(k)
	comb_list = list(itertools.combinations(list(range(k)), 2))
	for (n, comb) in zip(range(1, N + 1), comb_list):
		output[comb[0]].append(n)
		output[comb[1]].append(n)
	length = len(output[0])
	for l in output:
		print(length, *l)


import math
N = int(input())
kf = (math.sqrt(8 * N + 1) + 1) / 2
k = int(kf)
if k != kf:
	print('No')
else:
	print('Yes')
	print(k)
	for i in range(1, k + 1):
		print(k - 1, end=' ')
		elements = []
		for j in range((i - 1) * (i - 2) // 2 + 1, i * (i - 1) // 2 + 1):
			elements.append(j)
		for q in range(i + 1, k + 1):
			elements.append(i + (q - 1) * (q - 2) // 2)
		last = elements.pop()
		for e in elements:
			print(e, end=' ')
		print(last)


n = int(input())
num = 0
for i in range(1, 10 ** 3):
	if i * (i - 1) // 2 == n:
		num = i
		break
if num == 0:
	print('No')
	exit()
length = num - 1
(A, cnt) = ([], 1)
for i in range(1, num):
	B = []
	cnt += i - 1
	for j in range(i):
		B.append(cnt + j)
	for j in range(i, length):
		B.append(B[-1] + j)
	A.append(B)
A.append([i * (i + 1) // 2 for i in range(1, length + 1)])
print('Yes')
print(length + 1)
for i in A:
	print(length, *i)


l = {}
sum_n = 0
n = 1
while sum_n <= 10 ** 5:
	sum_n += n
	l[sum_n] = n
	n += 1
n = int(input())
if n not in l:
	print('No')
else:
	print('Yes')
	m = l[n]
	print(m + 1)
	ans = [[m] for _ in range(m + 1)]
	min_n = 1
	max_n = 1
	for i in range(1, m + 1):
		max_n += i
		for j in range(min_n, max_n):
			ans[j - min_n].append(j)
			ans[i].append(j)
		min_n = max_n
	for i in ans:
		print(*i)


N = int(input())
K = ((8 * N + 1) ** (1 / 2) + 1) / 2

def recursive(k):
	if k == 2:
		return [[1], [1]]
	else:
		before = recursive(k - 1)
		r = [_ for _ in range(1 + (k - 2) * (k - 1) // 2, 1 + k * (k - 1) // 2)]
		return [before[_] + [r[_]] for _ in range(len(r))] + [r]
if K.is_integer():
	K = int(K)
	print('Yes')
	print(K)
	[print(K - 1, ' '.join(map(str, ary))) for ary in recursive(K)]
else:
	print('No')


N = int(input())
for k in range(N + 2):
	if k * (k - 1) == 2 * N:
		S = [[] for _ in range(k + 1)]
		n = 1
		for i in range(2, k + 1):
			for j in range(1, i):
				S[i].append(n)
				S[j].append(n)
				n += 1
		print('Yes')
		print(k)
		for i in range(1, k + 1):
			ans = [len(S[i])] + S[i]
			print(' '.join(map(str, ans)))
		exit()
print('No')


N = int(input())
k = 0
while N != k * (k - 1) // 2:
	k += 1
	if k == 1000:
		break
if k == 1000:
	print('No')
else:
	ans = [[] for _ in range(k)]
	cnt = 0
	for i in range(k):
		for j in range(i + 1, k):
			ans[i].append(cnt + 1)
			ans[j].append(cnt + 1)
			cnt += 1
	print('Yes')
	print(k)
	for a in ans:
		print(k - 1, *a)


n = int(input())
for i in range(10 ** 5):
	if 2 * n == i ** 2 - i:
		k = i
		break
	elif 2 * n < i ** 2 - i:
		print('No')
		exit()
k = int(k)
print('Yes')
print(k)
(num, ans) = (1, [[] for _ in range(k)])
for i in range(k):
	for j in range(i + 1, k):
		ans[i].append(num)
		ans[j].append(num)
		num += 1
	print(k - 1, *ans[i])


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import itertools
N = int(input())
k = 1
while k * (k + 1) // 2 <= N:
	k += 1
if k * (k - 1) // 2 == N:
	S = [[] for _ in range(k)]
	for (i, (a, b)) in enumerate(itertools.combinations(range(k), 2), 1):
		S[a].append(i)
		S[b].append(i)
	print('Yes')
	print(k)
	for se in S:
		print(len(se), *se)
else:
	print('No')


n = int(input())
d = int((1 + 8 * n) ** (1 / 2))
if d ** 2 != 1 + 8 * n or d % 2 == 0:
	print('No')
	exit()
k = (1 + d) // 2
print('Yes')
print(k)
haba = 1
cnt = 1
ret = [[] for i in range(k)]
while cnt <= n:
	for s in range(k - haba):
		ret[s].append(cnt)
		ret[s + haba].append(cnt)
		cnt += 1
	haba += 1
for i in ret:
	print(len(i), *i)


N = int(input())
size = 1
while True:
	n = size * (size - 1) // 2
	if n == N:
		break
	elif n > N:
		print('No')
		exit()
	size += 1
sets = [[] for _ in range(size)]
n = 1
for i in range(size):
	for j in range(i + 1, size):
		sets[i].append(n)
		sets[j].append(n)
		n += 1
print('Yes')
print(size)
for i in range(size):
	print(' '.join(map(str, [len(sets[i])] + sets[i])))


import math
n = int(input())
m = int(math.sqrt(8 * n + 1))
if m * m != 8 * n + 1:
	print('No')
else:
	k = int((m + 1) / 2)
	S = [[] for h in range(k)]
	l = 1
	for i in range(k - 1):
		for j in range(i + 1, k):
			S[i].append(l)
			S[j].append(l)
			l += 1
	print('Yes')
	print(k)
	s = '{} ' * k
	t = s.rstrip(' ')
	for p in range(k):
		print(t.format(k - 1, *S[p]))


n = int(input())
k = int((n * 2) ** 0.5)
if k * (k + 1) // 2 != n:
	print('No')
	exit()
print('Yes')
print(k + 1)
l = [set() for _ in range(k + 1)]
t = 0
for i in range(k):
	for j in range(i + 1):
		t += 1
		l[i].add(t)
		l[j].add(t)
	l[-1].add(t)
for x in l:
	print(k, ' '.join(map(str, x)))


n = int(input())
k = 0
for i in range(1, n + 1):
	if i * (i + 1) // 2 == n:
		k = i
		break
else:
	k = -1
if k == -1:
	print('No')
else:
	arr = [[k] for _ in range(k + 1)]
	tmp = 0
	tk = 0
	while k - tk > 0:
		for i in range(tmp + 1, tmp + k + 1 - tk):
			arr[tk].append(i)
		for i in range(tk + 1, k + 1):
			arr[i].append(tmp + i - tk)
		tmp += k - tk
		tk += 1
	print('Yes')
	print(k + 1)
	for row in arr:
		print(*row)


n = int(input())
for k in range(10000):
	if k * (k - 1) == 2 * n:
		break
	elif k * (k - 1) > 2 * n:
		print('No')
		exit()
print('Yes')
print(k)
ret = [[] for _ in range(k)]
ii = 0
for i in range(k - 1):
	for j in range(1, k - i):
		ret[i].append(ii + j)
		ret[i + j].append(ii + j)
	ii += k - i - 1
for i in range(k):
	print(' '.join(map(str, [k - 1] + ret[i])))


N = int(input())
n1 = 8 * N + 1
a = int(n1 ** 0.5)
if N == 1:
	print('Yes')
	print(2)
	print(1, 1)
	print(1, 1)
elif n1 == a ** 2:
	n = (-3 + a) // 2
	d = [[0] * (n + 1) for _ in range(n + 2)]
	d[0][0] = 1
	d[0][1] = 2
	d[1][0] = 2
	d[1][1] = 3
	d[2][0] = 3
	d[2][1] = 1
	for i in range(1, n):
		v = 4 + (i - 1) * (i + 4) // 2
		c = 2 + i
		for j in range(c):
			d[c][j] = v + j
			d[j][c - 1] = v + j
	print('Yes')
	print(n + 2)
	for i in range(n + 2):
		print(n + 1, *d[i], sep=' ')
else:
	print('No')


import sys
N = int(input())
for k in range(1, 10 ** 9):
	if N == k * (k + 1) // 2:
		break
	elif N < k * (k + 1) // 2:
		print('No')
		sys.exit(0)
print('Yes')
print(k + 1)
cnt = 1
set_list = [set() for _ in range(k + 1)]
for i in range(k + 1):
	for j in range(i + 1, k + 1):
		set_list[i].add(cnt)
		set_list[j].add(cnt)
		cnt += 1
for i in range(k + 1):
	print(k, *set_list[i])


import itertools
N = int(input())
for k in range(1000):
	if N * 2 == k * (k - 1):
		print('Yes')
		print(k)
		ans = [[] for i in range(k)]
		c = list(itertools.combinations(range(k), 2))
		for i in range(N):
			for j in c[i]:
				ans[j].append(i + 1)
		for i in ans:
			print(k - 1, end=' ')
			for j in i:
				print(j, end=' ')
			print()
		break
else:
	print('No')


N = int(input())
MAX = 450
A = [[1], [1]]
size = 0
for i in range(1, MAX):
	if i * (i + 1) // 2 == N:
		size = i + 1
		break
if size == 0:
	print('No')
	exit()
now = 2
while now < size:
	start = now * (now - 1) // 2 + 1
	last = [start + i for i in range(now)]
	for j in range(len(A)):
		A[j].append(last[j])
	A.append(last)
	now += 1
print('Yes')
print(len(A))
for x in A:
	x.insert(0, len(A) - 1)
	print(*x)


n = int(input())
k = -1
for i in range(1, 10 ** 5 + 1):
	if i * (i - 1) == 2 * n:
		k = i
		break
if k == -1:
	print('No')
else:
	ans = [[] for _ in range(k)]
	print('Yes')
	print(k)
	tmp = 1
	for i in range(k):
		for j in range(i + 1, k):
			ans[i].append(tmp)
			ans[j].append(tmp)
			tmp += 1
	for i in range(k):
		print(len(ans[i]), *ans[i])


n = int(input())
k = ((8 * n + 1) ** 0.5 - 1) / 2
if k.is_integer():
	print('Yes')
	ik = int(k)
	print(ik + 1)
	(prel, newl) = ([], [])
	(nexv, last) = (0, 0)
	for i in range(ik + 1):
		if i == 0:
			print(ik, *[t + 1 for t in range(ik)])
			nexv = 1
		else:
			last += ik - i + 1
			newl = [b + last + 1 for b in range(ik - i)]
			for b in range(len(prel)):
				prel[b] += 1
			print(ik, *prel + [nexv] + newl)
			prel.append(nexv)
			if newl:
				nexv = newl[0]
else:
	print('No')


import sys
from itertools import combinations
n = int(input())
for i in range(1, 1000):
	if n == i * (i + 1) // 2:
		print('Yes')
		print(i + 1)
		anslist = [[] for _ in range(i + 1)]
		for (j, v) in enumerate(combinations([int(x) for x in range(i + 1)], r=2)):
			anslist[v[0]].append(j + 1)
			anslist[v[1]].append(j + 1)
		for ans in anslist:
			print(len(ans), *ans)
		sys.exit()
print('No')


import sys
from itertools import combinations

def I():
	return int(sys.stdin.readline().rstrip())
N = I()
A = [i * (i - 1) // 2 for i in range(448)]
index = 0
for i in range(2, 448):
	if A[i] == N:
		print('Yes')
		print(i)
		index = i
		break
else:
	print('No')
	exit()
ANS = [[index - 1] for _ in range(index)]
for (i, a) in enumerate(list(combinations([i for i in range(index)], 2))):
	(b, c) = a
	ANS[b].append(i + 1)
	ANS[c].append(i + 1)
for ans in ANS:
	print(*ans)


from itertools import combinations
N = int(input())
k = 2
while k * (k - 1) // 2 < N:
	k += 1
if k * (k - 1) // 2 != N:
	print('No')
else:
	print('Yes')
	S = {i: [] for i in range(1, k + 1)}
	cnt = 1
	for x in combinations(range(1, k + 1), 2):
		S[x[0]].append(cnt)
		S[x[1]].append(cnt)
		cnt += 1
	print(k)
	for i in range(1, k + 1):
		print(len(S[i]), *S[i])


from itertools import combinations as comb
n = int(input())
l = int((2 * n) ** 0.5)
if 2 * n == l * (l + 1):
	print('Yes')
	print(l + 1)
	ans = [[] for i in range(l + 1)]
	for (i, j) in zip(range(n), comb(range(l + 1), 2)):
		ans[j[0]].append(i + 1)
		ans[j[1]].append(i + 1)
	for i in ans:
		print(l, *i, sep=' ')
else:
	print('No')


n = int(input())
for k in range(1, n + 2):
	if k * (k - 1) == 2 * n:
		print('Yes')
		break
	if k * (k - 1) > 2 * n:
		print('No')
		exit()
print(k)
answer = [[] for _ in range(k)]
num = [[i, j] for i in range(k) for j in range(i + 1, k)]
for (i, st) in enumerate(num):
	(s, t) = st
	answer[s].append(i + 1)
	answer[t].append(i + 1)
for ans in answer:
	print(k - 1, *ans)


import itertools
N = int(input())
r = int((N * 2) ** 0.5)
if r * (r + 1) == N * 2:
	print('Yes')
	print(r + 1)
	ans = [[r] for _ in range(r + 2)]
	for (i, c) in enumerate(itertools.combinations(range(1, r + 2), 2), start=1):
		ans[c[0]].append(i)
		ans[c[1]].append(i)
	for a in ans[1:]:
		print(*a)
else:
	print('No')


from math import sqrt
from itertools import combinations
n = int(input())
a = int(sqrt(2 * n))
if n - a * (a + 1) // 2:
	print('No')
else:
	print('Yes')
	print(a + 1)
	(x, y, m) = ([[str(a)] for i in range(a + 1)], [i for i in range(a + 1)], 1)
	for (i, j) in combinations(y, 2):
		x[i].append(str(m))
		x[j].append(str(m))
		m += 1
	for i in x:
		print(' '.join(i))


N = int(input())
S = []
hoge = 1
i = 0
while hoge <= N:
	S.append([])
	i += 1
	for j in range(i):
		S[-1].append(hoge)
		hoge += 1
if S[-1][-1] == N:
	print('Yes')
else:
	print('No')
	exit()
N = len(S)
print(N + 1)
for i in range(N):
	print(N, end=' ')
	(x, y) = (0, i)
	for j in range(i + 1):
		x = j
		print(S[y][x], end=' ')
	for j in range(i + 1, N):
		y = j
		print(S[y][x], end=' ')
	print()
print(N, end=' ')
for i in S:
	print(i[-1], end=' ')
print()


n = int(input())
for l in range(1, 10 ** 3):
	if l * (l - 1) // 2 == n:
		print('Yes')
		print(l)
		S = [[] for _ in range(l)]
		now = 0
		count = 1
		for j in range(l - 1):
			for k in range(l - 1 - j):
				S[now].append(count)
				S[now + 1 + k].append(count)
				count += 1
			now += 1
		for s in S:
			print(l - 1, *s)
		break
else:
	print('No')


n = int(input())
if int((2 * n) ** 0.5) * int((2 * n) ** 0.5 + 1) == 2 * n:
	print('Yes')
	k = int((2 * n) ** 0.5 + 1)
	print(k)
	l = []
	for i in range(k):
		if i == 0:
			l.append([j + 1 for j in range(k - 1)])
			lused = k - 1
		else:
			addl = []
			for j in range(i):
				addl.append(l[j][i - 1])
			for j in range(k - 1 - i):
				addl.append(lused + 1)
				lused += 1
			l.append(addl)
	for i in l:
		print(2 * n // k, *i)
else:
	print('No')


import math
n = int(input())
x = (-1 + math.sqrt(1 + 8 * n)) / 2
if not x.is_integer():
	print('No')
	exit(0)
x = int(x)
ans = []
k = 1
for i in range(x + 1):
	a = []
	for j in range(x):
		if j >= i:
			a.append(k)
			k += 1
		else:
			a.append(ans[j][i - 1])
	ans.append(a)
print('Yes')
print(x + 1)
for i in range(x + 1):
	print(x, *ans[i])


n = int(input())
k = 0
for i in range(10 ** 3):
	if i * (i - 1) // 2 == n:
		k = i
		break
else:
	print('No')
	exit()
ans = [[] for _ in range(k)]
cnt = 1
for i in range(k):
	for j in range(i + 1, k):
		ans[i].append(cnt)
		ans[j].append(cnt)
		cnt += 1
print('Yes')
print(k)
for i in range(k):
	print(k - 1, *ans[i])


from itertools import combinations
n = int(input())
root = 1 + 8 * n
if int(root ** 0.5) ** 2 != root:
	print('No')
	exit()
k = (1 + int(root ** 0.5)) // 2
ans = [[] for _ in range(k)]
for (i, a) in enumerate(combinations(range(k), 2)):
	(s, t) = a
	ans[s].append(i + 1)
	ans[t].append(i + 1)
print('Yes')
print(k)
for List in ans:
	print(k - 1, *List)


N = int(input())
Ss = [[1], [1]]
while True:
	k = len(Ss)
	m = k * (k - 1) // 2
	if N < m:
		print('No')
		break
	elif N == m:
		print('Yes')
		print(k)
		for S in Ss:
			print(len(S), ' '.join(map(str, S)))
		break
	S_new = []
	for i in range(k):
		x = m + 1 + i
		Ss[i].append(x)
		S_new.append(x)
	Ss.append(S_new)


from itertools import combinations
n = int(input())
k = -1
for i in range(10 ** 3):
	if i * i - i - 2 * n == 0:
		k = i
if k == -1:
	print('No')
	exit()
num = 0
V = [[] for _ in range(k)]
for cmb in combinations(range(k), r=2):
	num += 1
	(a, b) = cmb
	V[a].append(num)
	V[b].append(num)
print('Yes')
print(k)
for v in V:
	print(len(v), end=' ')
	print(*v)


n = int(input())
if n == 1:
	print('Yes')
	print('2\n1 1\n1 1')
	exit()
for i in range(n):
	if i * (i + 1) // 2 == n:
		break
else:
	print('No')
	exit()
m = i
a = [[0] * m for _ in range(m)]
i = 0
while n > 0:
	for j in range(i + 1):
		a[i][j] = n
		n -= 1
	i += 1
a = a[::-1]
s = [[] for _ in range(m + 1)]
for i in range(m):
	s[i] = a[i][:m - i]
	for j in range(i):
		s[i] += [a[i - 1 - j][m - i - 1]]
for i in range(m):
	s[-1] += [a[i][m - i - 1]]
print('Yes')
print(len(s))
for i in s:
	print(len(i), *i)


import sys
N = int(input())
k = 0
while k * (k + 1) <= 2 * N:
	if k * (k + 1) == 2 * N:
		lis = [[] for i in range(k + 1)]
		now = 1
		for i in range(k):
			for j in range(k - i):
				lis[i].append(now)
				lis[i + 1 + j].append(now)
				now += 1
		print('Yes')
		print(k + 1)
		for i in range(k + 1):
			print(k, ' '.join(map(str, lis[i])))
		sys.exit()
	k += 1
print('No')


N = int(input())
x = 1
while x * (x - 1) // 2 < N:
	x += 1
if x * (x - 1) // 2 > N:
	print('No')
else:
	print('Yes')
	print(x)
	a = [[] for i in range(x)]
	from itertools import combinations
	y = 1
	for (i, j) in combinations(range(x), 2):
		a[i].append(y)
		a[j].append(y)
		y += 1
	for l in a:
		print(x - 1, *l)


N = int(input())
K = 1
while K * (K - 1) // 2 <= N:
	if K * (K - 1) // 2 == N:
		break
	K += 1
else:
	print('No')
	exit()
print('Yes')
s = 1
ans = [[] for i in range(K)]
for k in range(K - 1, 0, -1):
	for i in range(k):
		ans[K - k - 1].append(s + i)
		ans[K - k + i].append(s + i)
	s += k
print(K)
for i in range(K):
	ans[i].insert(0, len(ans[i]))
	print(*ans[i])


n = int(input())
l = []
s = 0
for i in range(n + 2):
	l.append(s)
	s += i + 1
if n not in l:
	print('No')
else:
	k = l.index(n) + 1
	ans = [[] for i in range(k)]
	c = 0
	for i in range(k):
		for j in range(i + 1, k):
			ans[i].append(c + 1)
			ans[j].append(c + 1)
			c += 1
	print('Yes')
	print(k)
	for i in range(k):
		print(k - 1, *ans[i])


N = int(input())
k = 2
while 1:
	if k * (k - 1) // 2 == N:
		break
	if k * (k - 1) // 2 > N:
		print('No')
		exit()
	k += 1
print('Yes')
print(k)
ans = [[] for _ in range(k)]
a = 1
for i in range(k - 1):
	for j in range(i + 1, k):
		ans[i].append(a)
		ans[j].append(a)
		a += 1
for row in ans:
	print(*[len(row)] + row)


def main():
	n = int(input())
	l = []
	i = 1
	while n > 0:
		n -= i
		t = i * (i - 1) // 2
		l += [list(range(t + 1, t + i + 1))]
		i += 1
	if n < 0:
		print('No')
		exit()
	print('Yes')
	i -= 1
	ans = [i + 1] + [i] + [l[j][-1] for j in range(i)]
	for j in range(i):
		ans += [i] + l[j] + [l[k][j] for k in range(j + 1, i)]
	print(' '.join(map(str, ans)))
main()


def grid(N):
	n = 0
	while n * (n + 1) < N * 2:
		n += 1
	if n * (n + 1) != N * 2:
		print('No')
		return
	S = [[0] * n for _ in range(n + 1)]
	cnt = 1
	for i in range(n + 1):
		for j in range(n):
			if i <= j:
				S[i][j] = cnt
				cnt += 1
			else:
				S[i][j] = S[j][i - 1]
	print('Yes')
	print(len(S))
	for s in S:
		print(n, end=' ')
		print(*s, sep=' ')
N = int(input())
grid(N)


def etrc(n1, n2, rs):
	for r in range(n1):
		rc[n2].append(rs + r)
		rc[n2 + r + 1].append(rs + r)
n = int(input())
x = int(((1 + 8 * n) ** 0.5 - 1) / 2)
rc = [[] for i in range(x + 2)]
if n != x * (x + 1) // 2:
	print('No')
else:
	print('Yes')
	print(x + 1)
	rs = 1
	for i in range(x):
		n1 = x - i
		n2 = i
		etrc(n1, n2, rs)
		rs = rs + n1
	for i in range(x + 1):
		print(x, end=' ')
		for j in range(x):
			print(rc[i][j], end=' ')
		print()


n = int(input())
r = int((2 * n) ** 0.5)
if 2 * n != r * (r + 1):
	print('No')
	exit()
res = [[]]
cnt = 1
num = 1
for i in range(r):
	l = list(range(cnt, cnt + num))
	res.append(l)
	for (j, k) in enumerate(l):
		res[j] += [k]
	cnt += num
	num += 1
print('Yes')
print(len(res))
for l in res:
	print(len(l), *l)


n = int(input())
k = (2 * n + 0.25) ** (1 / 2) + 1 / 2
if k - int(k) == 0:
	print('Yes')
	k = int(k)
	print(k)
	bset = [[] for i in range(k)]
	now = 1
	for i in range(k - 1):
		for j in range(i + 1, k):
			bset[i].append(now)
			bset[j].append(now)
			now += 1
	length = len(bset[0])
	for i in bset:
		print(length, ' '.join(list(map(str, i))))
else:
	print('No')


n = int(input())
k = int((n * 2) ** 0.5)
if k * (k + 1) // 2 == n:
	print('Yes')
	print(k + 1)
else:
	print('No')
	exit()
s = [[] for _ in range(k + 1)]
t = 1
for i in range(1, k + 1):
	for j in range(i):
		s[i].append(t)
		s[j].append(t)
		t += 1
for i in s:
	print(len(i), *i)


def main():
	n = int(input())
	if 2 * n != int((2 * n) ** 0.5) * (int((2 * n) ** 0.5) + 1):
		print('No')
		exit()
	print('Yes')
	l = int((2 * n) ** 0.5)
	print(l + 1)
	work = [[] for _ in range(l + 1)]
	now_sub = 0
	next_sub = 1
	for i in range(1, n + 1):
		if len(work[now_sub]) == l:
			now_sub += 1
			next_sub = now_sub + 1
		work[now_sub].append(i)
		work[next_sub].append(i)
		next_sub += 1
	for i in range(l + 1):
		print('{} {}'.format(l, ' '.join(map(str, work[i]))))
main()


N = int(input())
k = 0
for i in range(1, N + 1):
	if N == i * (i + 1) // 2:
		k = i
		break
if not k:
	print('No')
	exit()
S = [[0] * k for _ in range(k + 1)]
(base, span) = (1, k)
for i in range(k):
	S[i][i:i + span + 1] = list(range(base, base + span))
	for j in range(span):
		S[i + j + 1][j] = base + j
	(base, span) = (base + span, span - 1)
print('Yes')
print(k + 1)
for s in S:
	print(' '.join([str(s) for s in [k] + s]))


import math

def main():
	N = int(input())
	x = math.floor(math.sqrt(N * 2))
	if x * (x + 1) != N * 2:
		print('No')
		return
	print('Yes')
	print(x + 1)
	s = [[] for _ in range(x + 1)]
	counter = 1
	for i in range(x + 1):
		for j in range(i + 1, x + 1):
			s[i].append(counter)
			s[j].append(counter)
			counter += 1
	for i in range(x + 1):
		print(len(s[i]), *s[i])
main()


N = int(input())
cN = N
d = 1
while N % 2 == 0:
	N //= 2
	d += 1
k = -1
for i in range(1, int(N ** 0.5) + 1):
	if N % i == 0:
		if abs(i * 2 ** d - N // i) == 1:
			k = max(i * 2 ** d, N // i)
			break
		elif abs(N // i * 2 ** d - i) == 1:
			k = max(N // i * 2 ** d, i)
			break
if k == -1:
	print('No')
else:
	print('Yes')
	print(k)
	S = [[] for _ in range(k)]
	n = 0
	for j in range(k):
		for i in range(1, k - j):
			S[j].append(n + i)
			S[i + j].append(n + i)
		n += i
	for i in range(k):
		print(k - 1, ' '.join(map(str, S[i])))


n = int(input())
kaidan = [1]
for i in range(2, int((2 * n) ** 0.5 + 1)):
	kaidan.append(kaidan[-1] + i)
if not n in kaidan:
	print('No')
	exit()
print('Yes')
size = kaidan.index(n) + 1
print(size + 1)
hyo = [[0 for i in range(size)] for j in range(size)]
for i in range(size):
	for j in reversed(range(i + 1)):
		hyo[i][j] = kaidan[i] - (i - j)
		hyo[j][i] = hyo[i][j]
kar = []
for i in range(size):
	kar.append(hyo[i][i])
hyo.append(kar)
for i in range(size + 1):
	print(size, end=' ')
	print(*hyo[i])


N = int(input())
for i in range(10 ** 5):
	if i * (i + 1) // 2 == N:
		print('Yes')
		print(i + 1)
		ret = [[] for _ in range(i + 1)]
		cur = 1
		for j in range(i + 1):
			for _ in range(i - j):
				ret[j].append(cur)
				cur += 1
		for j in range(1, i + 1):
			for k in range(j):
				ret[j].append(ret[k][i - j])
		for j in range(i + 1):
			print(i, *ret[j])
		break
else:
	print('No')


N = int(input())
N_max = 10 ** 5
Trig = [0]
k = 1
T = 0
while T <= N_max:
	T += k
	k += 1
	Trig.append(T)
try:
	K = Trig.index(N) + 1
except:
	print('No')
	exit()
S = [set() for _ in range(K)]
m = 0
for i in range(K):
	for j in range(i + 1, K):
		m += 1
		S[i].add(m)
		S[j].add(m)
print('Yes')
print(K)
X = [''] * K
for i in range(K):
	X[i] = '{} '.format(len(S[i])) + ' '.join(map(str, S[i]))
print('\n'.join(X))


n = int(input())
if n == 1:
	print('Yes')
	print(2)
	print(1, 1)
	print(1, 1)
	exit()
for i in range(2, 10 ** 3):
	if i * (i + 1) == n * 2:
		(k, l) = (i + 1, i)
		break
else:
	print('No')
	exit()
print('Yes')
ans = [[] for _ in range(k)]
top = 0
bottom = 1
for i in range(1, n + 1):
	ans[top].append(i)
	ans[bottom].append(i)
	if bottom < k - 1:
		bottom += 1
	else:
		top += 1
		bottom = top + 1
print(len(ans))
for row in ans:
	print(len(row), *row)


n = int(input())
k = int((n * 2) ** 0.5) + 1
if k * (k - 1) != 2 * n:
	print('No')
else:
	print('Yes')
	print(k)
	arr = [list() for _ in range(k)]
	num = 1
	(tar1, tar2) = (0, 1)
	while True:
		arr[tar1].append(num)
		arr[tar2].append(num)
		if num == n:
			break
		else:
			num += 1
		if len(arr[tar1]) == k - 1:
			tar1 += 1
			tar2 = tar1 + 1
		else:
			tar2 += 1
	for i in range(k):
		print(k - 1, *arr[i])


N = int(input())
num = 0
flag = 0
for i in range(2, 1000):
	if 2 * N == i * (i - 1):
		num = i
		flag = 1
		break
if flag == 0:
	print('No')
else:
	l = [[] for _ in range(num)]
	cnt = 1
	for i in range(num):
		for j in range(i + 1, num):
			l[i].append(cnt)
			l[j].append(cnt)
			cnt = cnt + 1
	print('Yes')
	print(num)
	for i in range(num):
		print(num - 1, *l[i], sep=' ')


n = int(input())
num = 8 * n + 1
import math
a = int(math.sqrt(num))
ok = False
for i in [a - 2, a - 1, a, a + 1, a + 2]:
	if i ** 2 == num:
		ok = True
if not ok:
	print('No')
	exit()
print('Yes')
k = 1 + (a - 1) // 2
print(k)
from collections import defaultdict
ans = defaultdict(list)
i = 0
j = 1
for now in range(1, n + 1):
	ans[i].append(now)
	ans[j].append(now)
	j += 1
	if j == k:
		i += 1
		j = i + 1
		if i == k:
			break
for lis in ans.values():
	print(k - 1, end=' ')
	print(*lis)


n = int(input())
l = [i * (i - 1) // 2 for i in range(2, 450)]
if n in l:
	print('Yes')
	k = l.index(n) + 1
	print(k + 1)
	x = [[k] for _ in range(k + 1)]
	p = 1
	for i in range(k):
		for j in range(k - i):
			x[i].append(p + j)
			x[i + j + 1].append(p + j)
		p = p + k - i
	for i in x:
		print(*i)
else:
	print('No')


N = int(input())
X = 0
for i in range(1, 1000):
	X += i
	if X == N:
		P = [[] for j in range(i + 1)]
		X = 0
		for j in range(i):
			for k in range(i - j):
				P[j].append(k + X + 1)
			for k in range(i - j):
				P[k + j + 1].append(k + X + 1)
			X += i - j
		print('Yes')
		print(i + 1)
		for j in range(i + 1):
			print(len(P[j]), end=' ')
			print(*P[j])
		exit()
print('No')


N = int(input())
k = 2
while N >= (k - 1) * k / 2:
	if N == (k - 1) * k / 2:
		print('Yes')
		print(k)
		a = list(([] for i in range(k)))
		t = 1
		for i in range(0, k):
			for n in range(1, k - i):
				a[i].append(t)
				a[i + n].append(t)
				t += 1
		for i in range(k):
			print(str(k - 1) + ' ' + ' '.join(map(str, a[i])))
		exit()
	else:
		k += 1
print('No')


n = int(input())
k = int((n * 2) ** (1 / 2)) - 1
for i in range(10):
	if (k + i) * (k + i - 1) == n * 2:
		k += i
		break
if k * (k - 1) != n * 2:
	print('No')
	exit()
print('Yes')
print(k)
tri = []
for i in range(1, k):
	tri.append([j for j in range(i * (i - 1) // 2 + 1, i * (i + 1) // 2 + 1)])
for i in range(k - 1):
	print(k - 1, end=' ')
	print(*tri[i], end=' ')
	for j in range(i + 1, k - 1):
		print(tri[j][i], end=' ')
	print()
print(k - 1, end=' ')
for i in range(k - 1):
	print(tri[i][-1], end=' ')


n = int(input())
(flag, length) = (0, 0)
for i in range(1, 10 ** 3):
	if n == i * (i + 1) // 2:
		(flag, length) = (1, i)
		break
if not flag:
	print('No')
	exit()
A = []
for (i, j) in enumerate(range(1, length + 1)):
	num = j * (j + 1) // 2
	B = []
	for k in range(i):
		B.append(num - (k + 1))
	point = i + 1
	B.append(num)
	for k in range(length - (i + 1)):
		B.append(B[-1] + point)
		point += 1
	A.append(B)
A.append([i * (i + 1) // 2 for i in range(1, length + 1)])
print('Yes')
print(len(A))
for i in A:
	print(length, *i)


import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7
INF = 10 ** 18
eps = 10 ** (-7)
N = int(readline())
for i in range(1, 1000):
	if i * (i - 1) // 2 == N:
		k = i
		print('Yes')
		break
	if i == 999:
		print('No')
		exit()
print(k)
ans = [[] for i in range(k)]
now = 1
import itertools
L = [i for i in range(k)]
for v in itertools.combinations(L, 2):
	ans[v[0]].append(now)
	ans[v[1]].append(now)
	now += 1
for aaa in ans:
	print(len(aaa), ' '.join(map(str, aaa)))


N = int(input())
k = 1
yes_n = k * (k + 1) // 2
flag = False
while N >= yes_n:
	if N == yes_n:
		flag = True
		break
	k += 1
	yes_n = k * (k + 1) // 2
if flag:
	ans = []
	max_n = 1
	for i in range(k + 1):
		tmp = []
		for j in range(i):
			tmp += [ans[j][i - 1]]
		for j in range(k - i):
			tmp += [str(max_n)]
			max_n += 1
		ans += [tmp]
	print('Yes')
	print(k + 1)
	for a in ans:
		print(k, ' '.join(a))
else:
	print('No')


N = int(input())
for i in range(1, N + 2):
	if i * (i - 1) // 2 == N:
		print('Yes')
		ans = [[] for i in range(i)]
		cnt = 0
		p = 0
		q = 1
		while cnt < N:
			cnt += 1
			ans[p].append(cnt)
			ans[q].append(cnt)
			if q == i - 1:
				p += 1
				q = p + 1
			else:
				q += 1
		print(len(ans))
		for a in ans:
			print(len(a), *a)
		break
else:
	print('No')


n = int(input())
qi = 0
for i in range(1000):
	if i * (i + 1) == n * 2:
		qi = i
if qi == 0:
	print('No')
	exit()
print('Yes')
print(qi + 1)
from itertools import combinations as com
A = [[] for i in range(qi + 1)]
now = 1
for (i, j) in com([i for i in range(qi + 1)], 2):
	A[i].append(now)
	A[j].append(now)
	now += 1
for i in range(qi + 1):
	print(qi, *A[i])


N = int(input())
M = 1
while M * (M + 1) // 2 < N:
	M += 1
if M * (M + 1) // 2 != N:
	print('No')
	exit()
M += 1
S = [[] for i in range(M)]
k = 1
print('Yes')
print(M)
for i in range(M):
	for j in range(i + 1, M):
		S[i].append(k)
		S[j].append(k)
		k += 1
for i in range(M):
	print(M - 1, *S[i])


N = int(input())
for k in range(1, N + 2):
	sn = k - 1
	if k * sn != 2 * N:
		continue
	print('Yes')
	print(k)
	s = [[0] * sn for _ in range(sn)]
	for i in range(sn):
		s[i][i] = s[i - 1][i - 1] + (i + 1)
		for j in range(i + 1, sn):
			s[i][j] = s[i][j - 1] + j
			s[j][i] = s[i][j]
	s.append([s[i][i] for i in range(sn)])
	for x in s:
		print(sn, ' '.join(map(str, x)))
	break
else:
	print('No')


def resolve():
	N = int(input())
	K = 0
	for i in range(1, 1000):
		if i * (i - 1) // 2 == N:
			K = i
			break
	if K == 0:
		print('No')
		return
	else:
		S = [[] for _ in range(K)]
		cnt = 1
		for i in range(K):
			for j in range(i + 1, K):
				S[i].append(cnt)
				S[j].append(cnt)
				cnt += 1
	print('Yes')
	print(K)
	for s in S:
		print(len(s), *s)
resolve()


from itertools import combinations
N = int(input())
K = 0
for i in range(2, N + 2):
	if N == i * (i - 1) // 2:
		K = i
		break
if K == 0:
	print('No')
else:
	S = {i: [] for i in range(1, K + 1)}
	cnt = 1
	for x in combinations(range(1, K + 1), 2):
		(i, j) = x
		S[i].append(cnt)
		S[j].append(cnt)
		cnt += 1
	print('Yes')
	print(K)
	for i in range(1, K + 1):
		print(len(S[i]), *S[i])


N = int(input())
flg = 0
k = 0
while k * (k - 1) <= 2 * N:
	if k * (k - 1) == 2 * N:
		flg = 1
		break
	else:
		k += 1
if flg == 0:
	print('No')
else:
	print('Yes')
	print(k)
	S = [[k - 1] for _ in range(k)]
	cnt = 1
	for i in range(k - 1):
		for j in range(i + 1, k):
			S[i].append(cnt)
			S[j].append(cnt)
			cnt += 1
	for i in range(k):
		for j in range(k):
			if j == k:
				print(S[i][j])
			else:
				print(S[i][j], end=' ')
		print()


from math import sqrt, ceil

def tostr(a):
	return ' '.join(map(str, a))
N = int(input())
k = ceil(sqrt(N * 2))
if N != k * (k - 1) / 2:
	print('No')
	exit()
print('Yes')
print(k)
M = k - 1
a = [1]
for i in range(M - 1):
	a.append(a[-1] + i + 2)
print(M, tostr(a))
for i in range(M):
	a = [int(i * (i + 1) / 2) + 1]
	a += list(range(a[-1] + 1, a[-1] + i + 1))
	for j in range(i + 1, M):
		a.append(a[-1] + j)
	print(M, tostr(a))


n = int(input())
x = (-1 + (1 + 8 * n) ** 0.5) / 2
m = int((-1 + (1 + 8 * n) ** 0.5) // 2)
if x != m:
	print('No')
else:
	print('Yes')
	k = 2 * n // m
	print(k)
	s = [[] for i in range(k)]
	add = 1
	for i in range(m):
		for j in range(i + 1, k):
			s[i].append(add)
			s[j].append(add)
			add += 1
	for i in range(k):
		print(m, ' '.join([str(j) for j in s[i]]))


N = int(input())
e = 0
v = 1
while e <= 10 ** 5:
	if e == N:
		break
	e += v
	v += 1
else:
	print('No')
	exit()
print('Yes')
subsets = [set() for _ in range(v)]
k = 1
for i in range(v):
	for j in range(i + 1, v):
		subsets[i].add(k)
		subsets[j].add(k)
		k += 1
print(v)
for s in subsets:
	S = [len(s)] + list(s)
	print(' '.join(map(str, S)))


n = int(input())
f = 0
for i in range(1, n + 2):
	if i * (i - 1) // 2 == n:
		f = 1
		break
if f == 0:
	print('No')
	exit()
print('Yes')
print(i)
k = i
cnt = 0
s = [[-1] * k for _ in range(k)]
for i in range(k):
	for j in range(k):
		if i < j:
			s[i][j] = cnt
			cnt += 1
ans = [[] for _ in range(k)]
for i in range(k):
	for j in range(k):
		if s[i][j] != -1:
			ans[i].append(s[i][j] + 1)
			ans[j].append(s[i][j] + 1)
for x in ans:
	print(k - 1, *x)


N = int(input())
K = 0
for i in range(1, 500):
	if i * (i + 1) == 2 * N:
		K = i
		break
if K == 0:
	print('No')
	exit()
A = [[0] * K for _ in range(K)]
count = 1
for i in range(K):
	for j in range(i + 1):
		A[i][j] = count
		count += 1
print('Yes')
print(K + 1)
ans = []
for i in range(K):
	tmp = A[i][:i + 1]
	for y in range(i + 1, K):
		tmp.append(A[y][i])
	ans.append(tmp)
ans.append([A[i][i] for i in range(K)])
for a in ans:
	print(K, *a)


n = int(input())
k = int((2 * n) ** 0.5)
if k * (k + 1) // 2 != n:
	print('No')
	exit()
ans = [[x for x in range(k)]]
now = k
for j in range(k):
	tmp = []
	for i in range(j + 1):
		tmp.append(ans[i][j])
	for i in range(j + 1, k):
		tmp.append(now)
		now += 1
	ans.append(tmp)
print('Yes')
print(k + 1)
for x in ans:
	print(k, ' '.join(list(map(lambda y: str(y + 1), x))))


N = int(input())
tmp = 0
flag = True
for k in range(N + 1):
	tmp += k
	if tmp == N:
		break
	if tmp > N:
		flag = False
		break
if not flag:
	print('No')
	exit()
G = [[] for _ in range(k + 1)]
count = 1
for i in range(k):
	for j in range(i + 1, k + 1):
		G[i].append(count)
		G[j].append(count)
		count += 1
print('Yes')
print(k + 1)
for tmp in G:
	print(len(tmp), *tmp, sep=' ')


n = int(input())
tri = [1]
for i in range(2, 450):
	tri.append(i * (i + 1) // 2)
if not n in tri:
	exit(print('No'))
print('Yes')
ind = tri.index(n) + 2
ans = [[] for i in range(ind)]
cur = 1
print(ind)
for i in range(ind):
	for j in range(i + 1, ind):
		ans[i].append(cur)
		ans[j].append(cur)
		cur += 1
for i in ans:
	print(len(i), *i)


n = int(input())
f = 0
for k in range(1, 1000):
	if k * (k - 1) // 2 == n:
		f = 1
		break
if f == 0:
	print('No')
	exit()
else:
	print('Yes')
	print(k)
l = [[]] * k
a = 1
for i in range(1, k):
	for j in range(0, i):
		l[j] = l[j] + [str(a)]
		l[i] = l[i] + [str(a)]
		a += 1
for i in range(k):
	print(k - 1, ' '.join(l[i]))


from itertools import combinations
n = int(input())
k = 0
for i in range(2 * n + 1):
	if i * (i - 1) == 2 * n:
		k = i
		break
if k:
	ans = [[k - 1] for _ in range(k)]
	i = 1
	for (a, b) in combinations(range(k), 2):
		ans[a].append(i)
		ans[b].append(i)
		i += 1
	print('Yes')
	print(k)
	for ansi in ans:
		print(' '.join(list(map(str, ansi))))
else:
	print('No')


n = int(input())
for i in range(1, 1000):
	if i * (i + 1) // 2 == n:
		D = [[0] * i for l in range(i)]
		stopcnt = i
		cnt = 0
		(a, b) = (0, 0)
		print('Yes')
		print(i + 1)
		for j in range(n):
			D[a][j - b] = j + 1
			cnt += 1
			if cnt == stopcnt:
				a += 1
				b += stopcnt - 1
				cnt = 0
				stopcnt -= 1
		for a in range(i):
			for b in range(a, i):
				D[b][a] = D[a][b]
		DD = []
		for j in range(i):
			DD.append(D[j][j])
		D.append(DD)
		for j in D:
			print(len(j), *j)
		exit()
print('No')


def main():
	n = int(input())
	m = int((2 * n) ** 0.5)
	if m * (m + 1) == n * 2:
		print('Yes')
		m += 1
		print(m)
	else:
		print('No')
		exit()
	ans = [[m - 1] for i in range(m)]
	c = 1
	for i in range(m):
		for j in range(i + 1, m):
			ans[i].append(c)
			ans[j].append(c)
			c += 1
	for i in ans:
		print(' '.join(map(str, i)))
main()


n = int(input())
for i in range(10 ** 3):
	if n == i * (i + 1) // 2:
		x = i
		break
else:
	print('No')
	exit()
ans = [[] for i in range(x + 1)]
app = 0
for i in range(1, x + 1):
	for j in range(i):
		app += 1
		ans[j].append(app)
	ans[i].extend([k for k in range(i * (i - 1) // 2 + 1, i * (i + 1) // 2 + 1)])
print('Yes')
print(x + 1)
for ansarr in ans:
	print(x, *ansarr, sep=' ')


n = int(input())
for k in range(1000):
	temp = k * (k - 1) // 2
	if n == temp:
		print('Yes')
		print(k)
		res = [[] for _ in range(k)]
		p = 1
		for i in range(k):
			for j in range(i + 1, k):
				res[i].append(p)
				res[j].append(p)
				p += 1
		for x in res:
			print(' '.join(map(str, [k - 1] + x)))
		break
	elif n < temp:
		print('No')
		break


from itertools import combinations as cb
import sys
N = int(input())
k = (1 + int((1 + 8 * N) ** 0.5)) // 2
if k * (k - 1) // 2 != N:
	print('No')
	sys.exit()
print('Yes')
print(k)
x = list(cb(range(k), 2))
dp = [[] for i in range(k)]
for (i, (a, b)) in enumerate(x):
	dp[a].append(i + 1)
	dp[b].append(i + 1)
for r in dp:
	print(len(r), *r)


N = int(input())
flag = 0
for i in range(int((8 * N + 1) ** 0.5) + 1):
	if i * (i - 1) == 2 * N:
		flag = 1
		k = i
		break
if flag == 0:
	print('No')
else:
	print('Yes')
	S = [[] for _ in range(k)]
	cnt = 1
	for i in range(k - 1):
		for j in range(i + 1, k):
			S[i].append(cnt)
			S[j].append(cnt)
			cnt += 1
	print(k)
	for i in range(k):
		print(len(S[i]), *S[i])


n = int(input())
m = -1
for i in range(2, 10 ** 5):
	if n == i * (i - 1) // 2:
		m = i
		break
if m == -1:
	print('No')
	exit()
print('Yes')
ans = [[] for _ in range(m)]
for i in range(m - 1):
	if i == 0:
		x = 1
	else:
		x = ans[0][i]
	for j in range(m - 1):
		ans[i].append(x)
		if i <= j:
			x += j + 1
		else:
			x += 1
x = 1
for j in range(m - 1):
	ans[-1].append(x)
	x += j + 2
print(m)
for i in ans:
	print(m - 1, end=' ')
	print(*i)


n = int(input())
k = 0
for i in range(1, 2 * n + 1):
	if i * (i - 1) == 2 * n:
		k = i
if not k:
	print('No')
	exit()
S = [[] for _ in range(k)]
import itertools
C = list(itertools.combinations(range(k), 2))
for i in range(n):
	j = i + 1
	(c1, c2) = C[i]
	S[c1].append(j)
	S[c2].append(j)
print('Yes')
print(k)
for i in range(k):
	print(len(S[i]), *S[i])


n = int(input())
s = 0
i = 1
while s <= n:
	s += i
	if s == n:
		break
	i += 1
else:
	print('No')
	exit()
print('Yes')
print(i + 1)
A = [[] for i in range(i + 1)]
N = [i for i in range(n + 1)]
m = i
j = 1
for a in range(i + 1):
	A[a] += N[j:j + m]
	for k in range(a + 1, i + 1):
		A[k] += [j]
		j += 1
	print(i, *A[a])
	m -= 1


N = int(input())
k = 0
while k * (k + 1) // 2 < N:
	k += 1
if k * (k + 1) // 2 == N:
	print('Yes')
else:
	print('No')
	exit()
k += 1
lst = [[] for _ in range(k)]
tmp = 1
for i in range(k - 1):
	for j in range(k - 1 - i):
		lst[i].append(tmp)
		lst[i + j + 1].append(tmp)
		tmp += 1
print(k)
for i in lst:
	print(len(i), *i, sep=' ')


def main():
	n = int(input())
	num = 0
	sum = 0
	while sum <= n:
		if sum == n:
			print('Yes')
			break
		else:
			num += 1
			sum += num
	else:
		print('No')
		return
	Ss = []
	for i in range(num + 1):
		Ss.append([])
	insert = 0
	for i in range(1, num + 1)[::-1]:
		key = num - i
		for j in range(1, i + 1):
			insert += 1
			Ss[key].append(insert)
			Ss[key + j].append(insert)
	print(len(Ss))
	for i in range(len(Ss)):
		ans = ''
		ans += str(len(Ss[i])) + ' '
		ans += ' '.join(map(str, Ss[i]))
		print(ans)
main()


import sys

def main():
	input = sys.stdin.readline
	N = int(input())
	k = 1
	while k <= N * 2:
		if k * (k - 1) == 2 * N:
			break
		k += 1
	else:
		print('No')
		return
	print('Yes')
	print(k)
	ans = [[] for _ in range(k)]
	v = 1
	for i in range(k):
		for j in range(i + 1, k):
			ans[i].append(v)
			ans[j].append(v)
			v += 1
	for a in ans:
		print(len(a), *a)
main()


N = int(input())
if N == 1:
	print('Yes')
	print(2)
	print(1, 1)
	print(1, 1)
	quit()
S = [{1, 2}, {1, 3}, {2, 3}]
n = 3
while n < N:
	l = len(S)
	s = set()
	for i in range(l):
		n += 1
		S[i].add(n)
		s.add(n)
	S.append(s)
if n == N:
	print('Yes')
	print(len(S))
	for s in S:
		print(len(s), *s)
else:
	print('No')


import math
N = int(input())
k = math.ceil((2 * N) ** 0.5)
if N * 2 != k * (k - 1):
	print('No')
else:
	print('Yes')
	print(k)
	S = [[k - 1] for _ in range(k)]
	cnt = 1
	for i in range(k):
		for j in range(i + 1, k):
			S[i].append(cnt)
			S[j].append(cnt)
			cnt += 1
	for i in range(k):
		print(' '.join(map(str, S[i])))


def calc(N):
	n = 0
	for i in range(1, N + 1):
		n += i
		if n >= N:
			break
	if n != N:
		print('No')
		return
	print('Yes')
	print(i + 1)
	S = [list(range(1, i + 1))]
	print(i, *S[0])
	m = i
	for j in range(1, i + 1):
		S.append([])
		for s in S[:-1]:
			S[-1].append(s.pop())
		S[-1].extend(range(m + 1, m + 1 + i - j))
		m = max(S[-1])
		print(i, *S[-1])

def main():
	N = int(input())
	calc(N)
main()


N = int(input())
a = [[i * (i + 1) // 2 + j + 1 for j in range(i + 1)] for i in range(540)]
k = 1
while k * (k - 1) // 2 < N:
	k += 1
if k * (k - 1) // 2 == N:
	print('Yes')
	print(k)
	for i in range(k - 1):
		print(str(k - 1), end='')
		for j in range(i + 1):
			print(' ' + str(a[i][j]), end='')
		for j in range(i + 1, k - 1):
			print(' ' + str(a[j][i]), end='')
		print('')
	print(str(k - 1), end='')
	for i in range(k - 1):
		print(' ' + str(a[i][i]), end='')
	print('')
else:
	print('No')


n = int(input())
n2 = n * 2
key = [0, 0]
for i in range(1, int(n2 ** 0.5) + 3):
	if n2 % i == 0:
		if i * (i + 1) == n2:
			key = [i, i + 1]
			break
if key == [0, 0]:
	print('No')
	exit()
print('Yes')
(a, b) = key
print(b)
ans = [[0] * a for _ in range(b)]
cnt = 1
for i in range(b):
	for j in range(a):
		if j < i:
			ans[i][j] = ans[j][i - 1]
		else:
			ans[i][j] = cnt
			cnt += 1
for x in ans:
	print(len(x), ' '.join(map(str, x)))


def main():
	N = int(input())
	flag = 0
	tmp = 0
	a = 0
	for tmp in range(1, 1000):
		if tmp * (tmp - 1) // 2 == N:
			flag = 1
			break
	if flag == 0:
		print('No')
		exit()
	else:
		print('Yes')
		print(tmp)
	lst = [[]] * tmp
	for i in range(1, tmp):
		for j in range(i):
			a += 1
			lst[i] = lst[i] + [str(a)]
			lst[j] = lst[j] + [str(a)]
	for i in range(tmp):
		print(tmp - 1, ' '.join(lst[i]))
main()


N = int(input())
L = [[] for _ in range(1000)]
l = 0
r = 1
for i in range(1, N + 1):
	L[l].append(i)
	L[r].append(i)
	if r - l == 1:
		r += 1
		l = 0
	else:
		l += 1
if l != 0:
	print('No')
else:
	print('Yes')
	print(r)
	for i in range(r):
		print(len(L[i]), *L[i])


n = int(input())
for m in range(1, n + 1):
	if m * (m + 1) // 2 == n:
		break
else:
	print('No')
	exit()
a = []
k = 1
for i in range(m):
	b = [0] * m
	for j in range(i + 1):
		b[j] = k
		k += 1
	a.append(b)
ans = []
for i in range(m):
	b = [m]
	for j in range(i + 1):
		b.append(a[i][j])
	for k in range(j + 1, m):
		b.append(a[k][j])
	ans.append(b)
b = [m]
for i in range(m):
	b.append(a[i][i])
ans.append(b)
print('Yes')
print(len(ans))
for i in ans:
	print(*i)


n = int(input())
ans = True
for k in range(1, 500):
	if n == k * (k - 1) / 2:
		ans = False
		break
if ans:
	print('No')
	exit()
print('Yes')
print(k)
val = 1
ans_list = [[] for _ in range(k)]
for i in range(k - 1):
	for j in range(i + 1, k):
		ans_list[i].append(val)
		ans_list[j].append(val)
		val += 1
for a in ans_list:
	print(*[len(a)] + a)


N = int(input())

def printCompleteGraph(n):
	edge = [(u, v) for u in range(n) for v in range(u + 1, n) if u != v]
	name = {e: i + 1 for (i, e) in enumerate(edge)}
	for u in range(n):
		e = [name[min(u, v), max(u, v)] for v in range(n) if u != v]
		print(len(e), ' '.join(map(str, e)))
for n in range(2, max(N, 2) + 1):
	if n * (n - 1) // 2 == N:
		print('Yes')
		print(n)
		printCompleteGraph(n)
		exit()
print('No')


N = int(input())
triangle = [i * (i - 1) // 2 for i in range(0, 2 * N + 1)]
if not N in triangle:
	print('No')
else:
	print('Yes')
	k = triangle.index(N)
	print(k)
	count = 0
	S = [[] for i in range(0, k)]
	for i in range(0, k):
		if i == 0:
			S[i] = [j for j in range(1, k)]
			count = k - 1
		else:
			for j in range(0, i):
				S[i].append(S[j][i - 1])
			for j in range(0, k - 1 - i):
				S[i].append(count + 1)
				count += 1
		print(k - 1, *S[i])


n = int(input())
(l, r) = (0, 10 ** 4)
while r - l > 1:
	m = (l + r) // 2
	if m * (m - 1) // 2 <= n:
		l = m
	else:
		r = m
if l * (l - 1) // 2 != n:
	print('No')
else:
	print('Yes')
	print(l)
	a = [[] for _ in range(l)]
	t = 1
	for i in range(l):
		for j in range(i + 1, l):
			a[i].append(t)
			a[j].append(t)
			t += 1
	for x in a:
		print(len(x), end=' ')
		print(' '.join(map(str, x)))


n = int(input())
m = 0
i = 1
while True:
	m += i
	if m == n:
		print('Yes')
		print(i + 1)
		break
	elif m > n:
		print('No')
		exit()
	i += 1
ans = [[1], [1]]
max_ = 0
if i == 1:
	print('1 1')
	print('1 1')
else:
	max_a = 1
	for i_ in range(1, i):
		adds = list(range(max_a + 1, max_a + 1 + len(ans)))
		for (j, add) in enumerate(adds):
			ans[j].append(add)
		ans.append(adds)
		max_a = adds[-1]
	for a in ans:
		print(str(len(a)) + ' ' + ' '.join(map(str, a)))


import math
n = int(input())
s = (-1 + math.sqrt(1 + 8 * n)) / 2
if int(s) != s:
	print('No')
else:
	print('Yes')
	s = int(s)
	print(s + 1)
	A = []
	w = 1
	for i in range(s + 1):
		print(s, end=' ')
		for j in range(len(A)):
			print(A[j][i - j - 1], end=' ')
		A.append([])
		for j in range(s - len(A) + 1):
			print(w, end=' ')
			A[i].append(w)
			w += 1
		print()


def main():
	N = int(input())
	for k in range(1000):
		if k * (k - 1) // 2 == N:
			print('Yes')
			print(k)
			break
		if k * (k - 1) // 2 > N:
			print('No')
			return
	S = [[0] * (k - 1) for _ in range(k)]
	a = 1
	for i in range(k - 1):
		for j in range(k - i - 1):
			S[j][i] = a
			S[k - i - 1][i + j] = a
			a += 1
	for s in S:
		print(len(s), *s)
main()


n = int(input())
nn = int((n * 2) ** 0.5)
if n * 2 != nn * (nn + 1):
	print('No')
else:
	print('Yes')
	print(nn + 1)
	Ans = [[0] * nn for _ in range(nn + 1)]
	for i in range(nn):
		for j in range(nn - i):
			Ans[i][i + j] += nn * i - i * (i - 1) // 2 + j + 1
			Ans[i + j + 1][i] += nn * i - i * (i - 1) // 2 + j + 1
	for a in Ans:
		print(nn, *a)


import math
n = int(input())
num = 2 * n
tmp = int(math.sqrt(num))
if tmp * (tmp + 1) != num:
	print('No')
	exit()
print('Yes')
print(tmp + 1)
lst = [[] for _ in range(tmp + 1)]
last = 1
for i in range(tmp + 1):
	print(tmp, end=' ')
	cnt = 0
	for j in range(i):
		x = lst[j].pop()
		print(x, end=' ')
		cnt += 1
	for k in range(cnt, tmp):
		print(last, end=' ')
		lst[i].append(last)
		last += 1
	print()


import itertools
N = int(input())
X = int(((8 * N + 1) ** 0.5 - 1) // 2)
if N != X * (X + 1) // 2:
	print('No')
	exit()
index = 0
ans = [[X] for _ in range(X + 2)]
for (i, j) in itertools.combinations(range(1, X + 2), 2):
	index += 1
	ans[i] += [index]
	ans[j] += [index]
print('Yes')
print(X + 1)
[print(*_) for _ in ans[1:]]


N = int(input())
k = int((2 * N) ** 0.5) + 1
if k * (k - 1) == 2 * N:
	print('Yes')
	print(k)
	S = [[0 for j in range(k - 1)] for i in range(k)]
	(sx, sy) = (0, 0)
	n = 1
	while sx < k:
		for i in range(k - 1 - sx):
			S[sx][sy + i] = n + i
			S[sx + 1 + i][sy] = n + i
		n += k - 1 - sx
		sx += 1
		sy += 1
	for s in S:
		print(len(s), *s)
else:
	print('No')


import math
N = int(input())
(k, S, t) = (int(math.sqrt(N * 2)) + 1, [[1], [1]], [])
if k * (k - 1) != N * 2:
	print('No')
	exit()
for i in range(k - 2):
	S[0].append(S[0][i] + i + 1)
	S[1].append(S[1][i] + i + 2)
	t.append([S[0][i + 1]])
for i in range(k - 2):
	(b, n) = (False, t[i][-1] + 1)
	while n <= N:
		t[i].append(n)
		tk = int(math.sqrt(n * 2)) + 1
		if tk * (tk - 1) == n * 2:
			b = True
		n = t[i][-1] + len(t[i]) if b else t[i][-1] + 1
S += t
print('Yes')
print(k)
for s in S:
	print(k - 1, ' '.join(map(str, s)))


N = int(input())

def judge(n):
	n *= 2
	for d in range(1, n):
		if n == d * (d + 1):
			return (True, d)
	return (False, -1)
(flag, k) = judge(N)
if not flag:
	print('No')
	exit()
print('Yes')
print(k + 1)
l = [[] for _ in range(k + 1)]
c = 1
for i in range(k + 1):
	for j in range(i + 1, k + 1):
		l[i].append(c)
		l[j].append(c)
		c += 1
for line in l:
	print(k, end=' ')
	print(*line)


n = int(input())
r = []
c = 1
i = 1
while i <= n:
	r.append([])
	for j in range(1, c + 1):
		r[-1].append(i)
		i += 1
	c += 1
if i == n + 1:
	print('Yes')
	print(c)
	for j in range(c - 1):
		result = [c - 1]
		result.extend(r[j])
		for x in range(j + 1, c - 1):
			result.append(r[x][j])
		print(*result)
	result = [c - 1]
	for x in range(c - 1):
		result.append(r[x][x])
	print(*result)
else:
	print('No')


from itertools import combinations
n = int(input())
i = 1
plus = 1
flg = False
while i <= n:
	if i == n:
		flg = True
		break
	plus += 1
	i += plus
if flg:
	print('Yes')
	res = {i: [] for i in range(plus + 1)}
	for (i, combi) in enumerate(combinations(range(plus + 1), 2), 1):
		res[combi[0]].append(str(i))
		res[combi[1]].append(str(i))
	print(plus + 1)
	for (i, val) in res.items():
		print(str(plus) + ' ' + ' '.join(val))
else:
	print('No')