n = gets.chomp.to_i

if n == 1
  puts 'Yes'
  puts '2'
  puts '1 1'
  puts '1 1'
  exit
end

if n == 3
  puts 'Yes'
  puts '3'
  puts '2 1 2'
  puts '2 3 1'
  puts '2 2 3'
  exit
end

oks = [1]
2.upto(10**5) do |i|
  if i == (oks.last + oks.size + 1)
    oks.push(i)
  end
end

if !oks.include?(n)
  puts 'No'
  exit
end

num = oks.index(n) + 1

ans = Array.new(num + 1) { Array.new }
counts = Array.new(n, 0)

(num + 1).times do |i|
  1.upto(n) do |t|
    next if ans[i].size == num
    if i == 0
      ans[i].push(t)
      counts[t-1] += 1
    else
    i.times do |u|
      if !ans[u].include?(t) && counts[t-1] < 2
        ans[i].push(t)
        counts[t-1] += 1
      end
    end
    end
  end
end
p ans
