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 Pascal (FPC 2.6.2) (judge verdict: Wrong Answer)

var
  c:array[1..10000, 1..10000]of longint;
  f:array[1..2,1..100001]of boolean;
  a:array[1..140]of longint=(1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,136,153,171,190,210,231,253,276,300,325,351,378,406,435,465,496,528,561,595,630,666,703,741,780,820,861,903,946,990,1035,1081,1128,1176,1225,1275,1326,1378,1431,1485,1540,1596,1653,1711,1770,1830,1891,1953,2016,2080,2145,2211,2278,2346,2415,2485,2556,2628,2701,2775,2850,2926,3003,3081,3160,3240,3321,3403,3486,3570,3655,3741,3828,3916,4005,4095,4186,4278,4371,4465,4560,4656,4753,4851,4950,5050,5151,5253,5356,5460,5565,5671,5778,5886,5995,6105,6216,6328,6441,6555,6670,6786,6903,7021,7140,7260,7381,7503,7626,7750,7875,8001,8128,8256,8385,8515,8646,8778,8911,9045,9180,9316,9453,9591,9730,9870);
  i,k,m,p,q,j,n:longint;
  b:boolean;
begin
  readln(n);
  i:=1;
  while a[i]<=n do
  begin
    if a[i]=n then begin b:=true; break; end;
    inc(i);
  end;
  if b=false then begin writeln('No'); halt; end;
  if i=1 then begin writeln('Yes'); writeln('1 1'); writeln('1 1'); halt; end;
  b:=false;
  q:=0;
  fillchar(f,sizeof(f),false);
  writeln('Yes');
  writeln(i+1);
  for j:=1 to i+1 do
  begin
     write(i,' ');
	 for k:=1 to i do
	 begin
	 if (k<j) then 
	 begin
	    p:=c[k,j-1];
	    write(p,' ');
		f[2,p]:=true;
	end
	else 
	begin
	    if j>i then
		begin
	      for p:=1 to n do if f[2,p]=false then begin write(p,' '); f[2,p]:=true; end;
		  continue;
		end;
		inc(q);
		write(q,' ');
		f[1,q]:=true;
		c[j,k]:=q;
	end;
	end;
	writeln;
  end;
end.