from networkx import*

print(('NYOE S'[is_connected(Graph((t,j)for t in[*open(0)][1:]for j in t.split()[1:]))::2]))
from networkx import*

print(('YES'*is_connected(Graph((i,j)for i in[*open(0)][1:]for j in i.split()[1:]))or'NO'))
from networkx import *

print(
    (
        "NYOE S"[
            is_connected(
                Graph((t, j) for t in [*open(0)][1:] for j in t.split()[1:])
            ) :: 2
        ]
    )
)

from networkx import *

print(
    (
        "YES"
        * is_connected(Graph((i, j) for i in [*open(0)][1:] for j in i.split()[1:]))
        or "NO"
    )
)

-        "NYOE S"[ -            is_connected( -                Graph((t, j) for t in [*open(0)][1:] for j in t.split()[1:]) -            ) :: 2 -        ] +        "YES" +        * is_connected(Graph((i, j) for i in [*open(0)][1:] for j in i.split()[1:])) +        or "NO"