프로그램 명: prerequisite
제한시간: 1 초
// 번역 중....

프레디의 졸업을 도와라!

    3(프레디가 고른 코스 수. 밑줄에 프레디가 고른 코스의 넘버, 4자리 수가 온다.) 2(카테고리의 수)
    0123 9876 2222
    2(이 카테고리의 코스수) 1(최소 들어야할 코스 수) 8888 2222
    3(이 카테고리의 코스수) 2(최소 들어야할 코스 수) 9876 2222 7654
    
프레디는 0123, 9876, 2222를 골랐으니 졸업 가능 yes.

같은 코스가 다른 카테고리에 들어갈 수 있다. 프레디가 선택한 설렉션안에 있는 4자리수는 각각 다르다. 어떠한 카테고리안에 있는 4자리 수도 각각 다르다.

입력

입력의 첫 줄은 1 <= k <= 100 이다. 프레디가 선택한 코스의 수이다. 0 <= m <= 100 은 카테고리의 수이다. One or more lines follow containing k 4-digit integers follow; each is the number of a course selected by Freddie. 한 줄이상의 라인에 k 4 자리 정수가 따라온다. 각각은 프레디가 선택한 코스 번호이다. Each category is represented by a line containing 1 <= c <= 100, 각 카테고리는 한 라인으로 표시된다. 1 <= c <= 100 는 카테고리에 있는 코스의 수이다. 0 <= r <= c는 선택해야 할 최소 번호이다. the number of courses in the category, 0 <= r <= c, the minimum number of courses from the category that must be taken, and the c course numbers in the category. Each course number is a 4-digit integer. The same course may fulfil several category requirements. Freddie's selections, and the course numbers in any particular category, are distinct. A line containing 0 follows the last test case. For each test case, output a line containing "yes" if Freddie's course selection meets the degree requirements; otherwise output "no".

출력

졸업 요건을 만족하면 yes 아니면 no 를 출력한다.

입출력 예

입력

3 2
0123 9876 2222
2 1 8888 2222
3 2 9876 2222 7654 
3 2
0123 9876 2222
2 2 8888 2222
3 2 7654 9876 2222
0


출력

yes
no
출처: Waterloo local 2005.09.24

Freddie the frosh has chosen to take k courses. To meet the degree requirements, he must take courses from each of several categories. Can you assure Freddie that he will graduate, based on his course selection? Input consists of several test cases. For each case, the first line of input contains 1 ≤ k ≤ 100, the number of courses Freddie has chosen, and 0 ≤ m ≤ 100, the number of categories. One or more lines follow containing k 4-digit integers follow; each is the number of a course selected by Freddie. Each category is represented by a line containing 1 ≤ c ≤ 100, the number of courses in the category, 0 ≤ r ≤ c, the minimum number of courses from the category that must be taken, and the c course numbers in the category. Each course number is a 4-digit integer. The same course may fulfil several category requirements. Freddie's selections, and the course numbers in any particular category, are distinct. A line containing 0 follows the last test case.

For each test case, output a line containing "yes" if Freddie's course selection meets the degree requirements; otherwise output "no."

Sample Input
3 2
0123 9876 2222
2 1 8888 2222
3 2 9876 2222 7654 
3 2
0123 9876 2222
2 2 8888 2222
3 2 7654 9876 2222
0

Output for Sample Input
yes
no

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]