import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = readContents 3 >>= putStrLn . showRes . solve
    where
        showRes b
            | b = "YES"
            | otherwise = "NO" 

solve :: [[Int]] -> Bool
solve = (== ans) . map mf . group . sort . map length . group . sort . concat
    where
        mf = (,) <$> head <*> length
        ans = [(1, 2), (2, 2)]


readLine :: IO [Int]
readLine = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine