Problem:
Score : 500 points

Problem Statement

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.

Sample Input 1

3

Sample Output 1

Yes
3
2 1 2
2 3 1
2 2 3

It can be seen that (S_1,S_2,S_3)=(\{1,2\},\{3,1\},\{2,3\}) satisfies the conditions.

Sample Input 2

4

Sample Output 2

No

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
using namespace std;

#define MAX 100002

int n;

int ar[1002][1002];

int main() {
	cin >> n;
	if (n == 1) {
		puts("Yes");
		puts("2");
		cout << 1 << " " << 1 << endl;
		cout << 1 << " " << 1 << endl;
		return 0;
	}
	if (n == 3) {
		puts("Yes");
		cout << 3 << endl;
		cout << 2 << " " << 1 << " " << 2 << endl;
		cout << 2 << " " << 3 << " " << 1 << endl;
		cout << 2 << " " << 2 << " " << 3 << endl;
		return 0;
	}
	ar[0][0] = 1;
	ar[0][1] = 1;
	ar[0][2] = 2;
	ar[1][0] = 3;
	ar[1][1] = 2;
	ar[1][2] = 3;
	int card = 3;
	int val = 3;
	while (val < n) {
		int nex_l = val + 1;
		int nex_r = val +card;
		for (int i = 0; i < card; i++) {
			ar[card - 1][i] = nex_l + i;
		}
		for (int i = 0; i < card; i++) {
			ar[i][card] = nex_l + i;
		}
		card++;
		val = nex_r;
	}
	if (val != n) {
		puts("No");
		return 0;
	}
	puts("Yes");
	cout << card << endl;
	for (int i = 0; i < card; i++) {
		cout << card - 1;
		for (int j = 0; j < card - 1; j++) {
			printf(" %d", ar[j][i]);
		}
		puts("");
	}
	return 0;
}