import           Data.List
import           Data.Tuple

main :: IO ()
main = do
    n <- readLn :: IO Int
    case solve n of
        Just (k, mat) -> do
            putStrLn "Yes"
            print k
            putStr.unlines $ map (unwords.map show.((k - 1):)) mat
        Nothing -> putStrLn "No"

solve :: Int -> Maybe (Int, [[Int]])
solve 1 = Nothing
solve n = case find(\k->k*(k-1)==2*n)[1..317]of
    Nothing -> Nothing
    Just k -> Just (k, zipWith (++) tri $ transpose tri ++ [[]])
      where
        tri = snd $ mapAccumL ((swap.).flip splitAt) [1..n] [0..k-1]
