Pro.ID22147 TitleParty Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22147 AC1 Submit3 Ratio33.33% 时间&空间限制描述Tzdin wants to organize a ball in the Christmas Eve. N women and M ( M ≥ N ) men intend to take part in the party. At the beginning of the party, tzdin gives each woman several cards on which the profiles of the men are presented. Then each woman can choose a man from the cards as her partner. We assume that finally with the guidance of tzdin, each woman can choose a man from her cards. Now, we want to know which men are sure to have a partner in the end, no matter how the women choose nor how tzdin guaides. 输入The first line contains N and M ( 1 ≤ N ≤ M ≤ 1000 ). Then there are N lines. In the i-th line, first is a integer k, meaning that the i-th girl has k cards. Then comes k integers, which are the IDs of man. 输出Description Tzdin wants to organize a ball in the Christmas Eve. N women and M ( M ≥ N ) men intend to take part in the party. At the beginning of the party, tzdin gives each woman several cards on which the profiles of the men are presented. Then each woman can choose a man from the cards as her partner. We assume that finally with the guidance of tzdin, each woman can choose a man from her cards. Now, we want to know which men are sure to have a partner in the end, no matter how the women choose nor how tzdin guaides. Input The first line contains N and M ( 1 ≤ N ≤ M ≤ 1000 ). Then there are N lines. In the i-th line, first is a integer k, meaning that the i-th girl has k cards. Then comes k integers, which are the IDs of man. Output Just output the IDs of the men who are sure to have a partner in the end, each ID in one line. Sample Input 2 3 Sample Output 1 Source 样例输入2 3 样例输出1 作者 |