Dating

시간 제한3초메모리 제한2048 MB

문제

You are the developer of a dating app which ignores gender completely. The app has $n$ users, indexed from $1$ to $n$. Each user’s profile features a list of the activities they enjoy doing. There are $m$ possible activities, indexed from $1$ to $m$.

A match between two users is good if they share at least one activity and, at the same time, both of them like at least one activity that the other user does not like.

Find a good match if it exists.

입력

The first line contains two integers $n$ and $m$ ($2 ≤ n ≤ 200\, 000$, $1 ≤ m ≤ 10^6$) — the number of users and the number of activities.

Each of the following $n$ lines contains a number $k_i$ ($0 ≤ k_i ≤ m$) — the number of activities that user $i$ likes — followed by $k_i$ distinct integers from $1$ to $m$ — the activities user $i$ likes.

It is guaranteed that $k_1 + k_2 + \cdots + k_n$ does not exceed $10^6$.

출력

Print YES if a good match exists. Otherwise, print NO.

If a good match exists, on the next line print two integers — the indexes of two users that make a match.