import qualified Data.Set as Set
type Set = Set.Set
main = do
    getLine
    l <- getIntLine <$> getContents
    putStrLn $ showans $ answer l
getInt :: String -> Set Int
getInt = Set.fromList . tail . map read . words
getIntLine :: String -> [Set Int]
getIntLine = map getInt . lines

answer :: [Set Int] -> Bool
answer = (1 ==) . length . langgroup

showans :: Bool -> String
showans True = "YES"
showans False = "NO"

langgroup :: [Set Int] -> [Set Int]
langgroup (p:ps) = foldl langcon [p] ps

langcon :: [Set Int] -> Set Int -> [Set Int]
langcon langg newp = 
    let (a,b) = foldl foldfunc ([],newp) langg
        foldfunc (notint, int) x = 
            if x `Set.intersection` newp /= Set.empty
            then (notint,int `Set.union` x) 
            else (x:notint,int)
    in (b:a)
