시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB87785693.333%

문제

In the PHP (Paradise Hospital of Prague) they cure people with a lot of different diseases. The PHP is dealing with a shortage of medical personal, therefore the director is afraid of doctors getting sloppy. Doctors make a diagnosis based on the knowledge they gained in university. So there is a known list of possible diseases and a known list of possible symptoms a patient can have. A doctor makes a diagnosis of one or multiple diseases. Those diseases have known symptoms that need to match exactly with the symptoms of the patient.

More formally: given a set of diseases $D = \{d_1, d_2, ..., d_n\}$, a set of symptoms $S = \{s_1, s_2, ..., s_m\}$ and a function that represents the knowledge about diseases and their symptoms. $f(d) = S'$ with $S' \subseteq S$ and $d \subseteq D$. When a given $D' \subseteq D$ check whether or not the the condition $S = \bigcup_{d \in D'}f(d)$ is true. When it is print "yes" else print "no".

입력

  • One line with two integers $n$ and $m$, with $1 \leq n \leq 1000$ the number of diseases and $1 \leq m \leq 1000$ the number of symptoms. The patient has all symptoms $s_1$ to $s_m$.
  • One line with one integer $k$ followed by $k$ integers: the set of diseases $D'$ the patient has according to the doctor $(D' \subseteq D)$.
  • $n$ lines, corresponding to diseases $d_1$ to $d_n$, with an integer $p$ followed by $p$ integers: The symptoms belonging to disease $i$. These symptoms are given in ascending order.

출력

Print "yes" if the symptoms of the diagnosed diseases exactly match the patient's symptoms. Print "no" otherwise.

예제 입력 1

5 6
3 3 4 5
3 1 2 3
3 2 3 4
2 5 6
3 1 4 5
4 1 2 3 5

예제 출력 1

yes

예제 입력 2

5 6
4 1 2 4 5
3 1 2 3
3 2 3 4
2 5 6
3 1 4 5
4 1 2 3 5

예제 출력 2

no