{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import qualified Data.IntMap as IM

solve :: Int -> Maybe (Int, [[Int]])
solve n = do
  k <- getK n
  let mp0 = foldr op (IM.fromList (zip [1..k] (repeat [])))
            $ zip [1..] [(p,q) | q <- [k,k-1..2], p <- [1..q-1]]
      op :: (Int, (Int,Int)) -> IM.IntMap [Int] -> IM.IntMap [Int]
      op (m, (p,q)) mp = IM.adjust (m:) p $ IM.adjust (m:) q mp
  return (k, map ((k-1):) (map snd (IM.toList mp0)))

getK :: Int -> Maybe Int
getK n = let k = ceiling (sqrt (fromIntegral (2*n)))
         in if k*(k-1) == 2*n then Just k
            else if (k+1)*k == 2*n then Just (k+1)
                 else Nothing

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> Maybe (Int, [[Int]])
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_n]:remLines1 = remLines0
      n = readBInt bs_n
  in solve n

outAnswer :: Maybe (Int, [[Int]]) -> IO ()
outAnswer Nothing = putStrLn "No"
outAnswer (Just (n, xs)) = do
  putStrLn "Yes"
  putStrLn (show n)
  putStr (unlines (map (unwords . map show) xs))

main :: IO ()
main = outAnswer . tmain =<< B.getContents
