2419. Game with TOKOSHI

单点时限: 5.0 sec

内存限制: 256 MB

Mr. Sota Tokoshi was bored to death his life because it became routine. He went girl-hunting so much. However, it was too easy for him, so he felt boredom. Therefore, he has thought that there is a man who got a lot of attention from women in somewhere in the world and talking with him might change his routine life. Then, he asked a woman president of a company, one of his fans, to find a man got a lot of attention from women like him.

Few weeks later, it is March 1st of 2008 now, he met a rival. His name was Mr. Isaac H. Ives. It was said that he was the most popular with women in an elite university, East Capital university. In order to check whether Mr. Isaac got a lot of attention from women like Mr. Tokoshi, Mr. Tokoshi invited Mr. Isaac to a game.

The game is, Mr. Tokoshi and Mr. Isaac go girl-hunting and pick up a woman by turns until all women whose contact address is known by at least one player is picked up, and winner of this game is a person who picked up more women. A player is possible to do not pick up a women in his turn. However, a player of this game can pick up only a woman whose contact address is known by him or a woman who has already picked up by him. Moreover, it is impossible to pick up a woman who has already picked up by the opponent.

Your job is to write a program to calculate the winner of this game from given information. You can assume that Mr. Tokoshi and Mr. Isaac are a specialist of going girl-hunting, that is, they always succeed in picking up a woman. You can also assume that they are so clever that they always take the best method on each turn.

输入格式

Input consists of multiple test cases. The first line of each test case contains a single positive integer n ( n < 15 ), which indicates the number of women. Each woman has an ID from 1 to n respectively. The next line contains a list of women whose contact address is known by Mr. Tokoshi. The next line contains a list of women whose contact address is known by Mr. Isaac. In the following n lines, the i-th line contains a list of women whose address is known by a woman with ID i. Each list contains a non-negative integer and m (m < 15) positive integers less than or equal to n. The first integer m indicates the number of contact addresses that he or she knows. The remaining m integers indicate an ID of woman whose contact address is known by him or her. Input is terminated by a case of n = 0, and it should not be processed.

输出格式

For each test case, you should output “WIN” if Mr. Tokoshi wins, output “LOSE” if Mr. Tokoshi loses. Otherwise output “DRAW”.

样例

Input
3
1 1
1 2
2 2 3
2 1 3
2 1 2
0
Output
WIN

0 人解决,4 人已尝试。

0 份提交通过,共有 43 份提交。

9.9 EMB 奖励。

创建: 16 年前.

修改: 7 年,2 月前.

最后提交: 16 年前.

来源: Winter Contest 2008

题目标签