main = interact $ unlines . map (ball . map (read::String->Int) . words) . tail . lines

scanBy op (x:x':xs) = op x x' : scanBy op (x':xs)
scanBy _ _ = []

ball bs = if (length $ filter (== LT) (scanBy compare bs)) > 5 then "YES" else "NO"