module mod_t_list
  implicit none
  type :: t_list
    integer :: vol
    integer, pointer :: arr(:)
  end type t_list
  private
  public :: t_list, init_list, release_list, push_back
  public :: pop_back, poll_back, get_at, size_of_list
contains
  subroutine init_list(list)
    implicit none
    type(t_list), intent(inout) :: list
    list%vol = 0
    nullify(list%arr)
    allocate(list%arr(1))
    return
  end subroutine init_list
  subroutine release_list(list)
    implicit none
    type(t_list), intent(inout) :: list
    if (associated(list%arr)) deallocate(list%arr)
    return
  end subroutine release_list
  subroutine push_back(list,n)
    implicit none
    type(t_list), intent(inout) :: list
    integer, intent(in) :: n
    integer, allocatable :: tmp(:)
    if (size(list%arr).eq.list%vol) then
      allocate(tmp(list%vol))
      tmp = list%arr
      deallocate(list%arr)
      allocate(list%arr(2*list%vol))
      list%arr(1:list%vol) = tmp
      deallocate(tmp)
    end if
    list%vol = list%vol+1
    list%arr(list%vol) = n
    return
  end subroutine push_back
  function pop_back(list) result(n)
    implicit none
    type(t_list), intent(inout) :: list
    integer :: n
    n = list%arr(list%vol)
    list%vol = list%vol-1
    return
  end function pop_back
  subroutine poll_back(list)
    implicit none
    type(t_list), intent(inout) :: list
    list%vol = list%vol-1
    return
  end subroutine poll_back
  function get_at(list,i) result(n)
    implicit none
    type(t_list), intent(in) :: list
    integer, intent(in) :: i
    integer :: n
    n = list%arr(i)
    return
  end function get_at
  function size_of_list(list) result(s)
    implicit none
    type(t_list), intent(in) :: list
    integer :: s
    s = list%vol
    return
  end function size_of_list
end module mod_t_list
program crossing
  use mod_t_list
  implicit none
  type(t_list) :: ilist(0:450), jlist(0:450)
  integer :: n, m, i, j, s
  s = 0
  read(*,*) n
  m = (nint(sqrt(8.d0*real(n,8)+1.d0))-1)/2
  if (n.ne.m*(m+1)/2) then
    write(*,'(a)') "No"
    stop
  end if
  do i = 0, 450
    call init_list(ilist(i))
    call init_list(jlist(i))
  end do
  write(*,'(a)') "Yes"
  write(*,'(i0)') m+1
  s = 0
  write(*,'(i0)',advance='no') m
  do i = 1, m
    do j = 1, i
      call push_back(ilist(i),s+j)
      if (j.ne.i) call push_back(jlist(j),s+j)
    end do
    s = s+i
    write(*,'(x,i0)',advance='no') s
  end do
  write(*,*)
  do i = 1, m
    write(*,'(i0)',advance='no') m
    do j = 1, size_of_list(ilist(i))
      write(*,'(x,i0)',advance='no') get_at(ilist(i),j)
    end do
    do j = 1, size_of_list(jlist(i))
      write(*,'(x,i0)',advance='no') get_at(jlist(i),j)
    end do
    write(*,*)
  end do
  do i = 0, 450
    call release_list(ilist(i))
    call release_list(jlist(i))
  end do
  stop
end program crossing