import Data.List import Control.Applicative import Control.Monad import Debug.Trace main = do n <- readLn exp <- (map . map) (read :: String -> Integer) . map words <$> replicateM n getLine let exp' = head . reverse . sort $ map (\x -> (fst x, snd x !! 0 - 30000 * (snd x !! 1))) $ zip [1..] exp if snd exp' >= 500000 then do putStrLn "YES" replicateM_ 6 (print $ fst exp') else putStrLn "NO"