import Data.List import Control.Applicative import Control.Monad import Data.Ord import Debug.Trace main = do n <- readLn exp <- (map . map) (read :: String -> Integer) . map words <$> replicateM n getLine let exp' = head . reverse . sortBy (comparing snd) $ 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"