#P7234. [JSOI2014] 歌剧表演
[JSOI2014] 歌剧表演
Description
The artsy youth JYY really likes watching opera performances.
JYY knows what all the actors look like and also knows all their names, but he cannot match names to faces. JYY hopes that one day he can figure out exactly who each actor is.
The JSOI opera troupe has a total of actors and has held performances. All actors are numbered from to , and in the -th performance, there are actors participating.
JYY has seen photos of all actors (so he knows the faces of these actors), and he has also seen the roster of actors (so he knows the names of these actors; assume there are no duplicate names). He has also carefully watched all performances: in each performance, JYY knows which actors participated in this show and can tell their faces apart.
Now JYY wants to know: after watching these performances, can he match every actor’s name and face one by one?
Input Format
The first line contains two positive integers and .
In the next lines, each line first contains an integer , followed by distinct integers between and , indicating the actor numbers participating in this performance.
Output Format
Output one line with integers. The -th integer means that after the -th performance, JYY can match actor number with their face.
If after all performances JYY still cannot recognize this actor, then is .
4 3
1 1
1 3
1 2
1 3 2 3
Hint
Sample Explanation 1
In each performance, it is possible to determine the face of one actor, and actor is the only one who never participated in any performance. Since JYY already knew the faces of all actors at the beginning, after the third performance JYY can also confirm the face of actor .
Constraints
$1\leq n,m\leq 10^5,\sum\limits_{i=1}^{n}k_i\leq 10^5$。
Translated by ChatGPT 5
京公网安备 11011102002149号