CF234D Cinema
Description
Overall there are $ m $ actors in Berland. Each actor has a personal identifier — an integer from $ 1 $ to $ m $ (distinct actors have distinct identifiers). Vasya likes to watch Berland movies with Berland actors, and he has $ k $ favorite actors. He watched the movie trailers for the next month and wrote the following information for every movie: the movie title, the number of actors who starred in it, and the identifiers of these actors. Besides, he managed to copy the movie titles and how many actors starred there, but he didn't manage to write down the identifiers of some actors. Vasya looks at his records and wonders which movies may be his favourite, and which ones may not be. Once Vasya learns the exact cast of all movies, his favorite movies will be determined as follows: a movie becomes favorite movie, if no other movie from Vasya's list has more favorite actors.
Help the boy to determine the following for each movie:
- whether it surely will be his favourite movie;
- whether it surely won't be his favourite movie;
- can either be favourite or not.
Input Format
The first line of the input contains two integers $ m $ and $ k $ ( $ 1
Output Format
Print $ n $ lines in the output. In the $ i $ -th line print:
- 0, if the $ i $ -th movie will surely be the favourite;
- 1, if the $ i $ -th movie won't surely be the favourite;
- 2, if the $ i $ -th movie can either be favourite, or not favourite.
Explanation/Hint
Note to the second sample:
- Movie jumanji can theoretically have from 1 to 3 Vasya's favourite actors.
- Movie theeagle has all three favourite actors, as the actor Vasya failed to remember, can only have identifier 5.
- Movie matrix can have exactly one favourite actor.
- Movie sourcecode doesn't have any favourite actors.
Thus, movie theeagle will surely be favourite, movies matrix and sourcecode won't surely be favourite, and movie jumanji can be either favourite (if it has all three favourite actors), or not favourite.